Dataset Viewer
Auto-converted to Parquet Duplicate
code_tokens
listlengths
2
1.68k
docstring_tokens
listlengths
1
1.68k
[ "<code>public", "void", "testMissingPrimaryKeyLookupQuery()", "throws", "Exception", "{", "indexType2TweeterDocuments();", "final", "Table", "table", "=", "dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME);", "<START>", "final", "Column[]", "pks", "=", "table.getPrimaryKeys().toArray(new", "Column[0]);", "<END>", "try", "(DataSet", "ds", "=", "dataContext.query().from(table).selectAll().where(pks[0]).eq(\"missing\").execute())", "{", "assertFalse(ds.next());", "}", "}</code><technical_language>Please", "a", "name", "(primaryKeys,", "primaryKeyColumns)</technical_language>" ]
[ "public", "void", "testMissingPrimaryKeyLookupQuery()", "throws", "Exception", "{", "indexType2TweeterDocuments();", "final", "Table", "table", "=", "dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME);", "final", "Column[]", "primaryKeys", "=", "table.getPrimaryKeys().toArray(new", "Column[0]);", "try", "(final", "DataSet", "dataSet", "=", "dataContext", ".query()", ".from(table)", ".selectAll()", ".where(primaryKeys[0])", ".eq(\"missing\")", ".execute())", "{", "assertFalse(dataSet.next());", "}", "}" ]
[ "<code>public", "void", "loadJavaRDD()", "throws", "Exception", "{", "doReturn(javaPairRDD).when(sparkContext).newAPIHadoopFile(any(),", "any(),", "any(),", "any(),", "any());", "<START>", "doReturn(javaRDD).when(javaPairRDD).map(any());", "<END>", "JavaRDD<Country>", "retJavaRDD", "=", "SparkAvroLoader.loadJavaRDD(sparkContext,", "\"/avro/datastore\",", "Country.class);", "assertTrue(javaRDD", "==", "retJavaRDD);", "verify(sparkContext).newAPIHadoopFile(", "eq(\"/avro/datastore\"),", "eq(AvroKeyInputFormat.class),", "eq(Country.class),", "eq(NullWritable.class),", "configurationCaptor.capture());", "assertEquals(Country.SCHEMA$.toString(),", "configurationCaptor.getValue().get(\"avro.schema.input.key\"));", "verify(javaPairRDD).map(mapFunctionCaptor.capture());", "assertMapFunction(mapFunctionCaptor.getValue());", "verifyNoMoreInteractions(sparkContext,", "javaPairRDD);", "verifyZeroInteractions(javaRDD);", "}</code><technical_language>Wouln't", "expected", "type", "instead", "of", "any()</technical_language>" ]
[ "public", "void", "loadJavaRDD()", "throws", "Exception", "{", "doReturn(javaPairRDD).when(sparkContext).newAPIHadoopFile(eq(\"/avro/datastore\"),", "eq(AvroKeyInputFormat.class),", "eq(Country.class),", "eq(NullWritable.class),", "any(Configuration.class));", "doReturn(javaRDD).when(javaPairRDD).map(any(Function.class));", "JavaRDD<Country>", "retJavaRDD", "=", "SparkAvroLoader.loadJavaRDD(sparkContext,", "\"/avro/datastore\",", "Country.class);", "assertTrue(javaRDD", "==", "retJavaRDD);", "verify(sparkContext).newAPIHadoopFile(", "eq(\"/avro/datastore\"),", "eq(AvroKeyInputFormat.class),", "eq(Country.class),", "eq(NullWritable.class),", "configurationCaptor.capture());", "assertEquals(Country.SCHEMA$.toString(),", "configurationCaptor.getValue().get(\"avro.schema.input.key\"));", "verify(javaPairRDD).map(mapFunctionCaptor.capture());", "assertMapFunction(mapFunctionCaptor.getValue());", "verifyNoMoreInteractions(sparkContext,", "javaPairRDD);", "verifyZeroInteractions(javaRDD);", "}" ]
[ "<code>protected", "AuditMessageType", "getParticipantObjectIdentificationForRequest(PRPAIN201306UV02", "request,", "AssertionType", "assertion,", "AuditMessageType", "auditMsg)", "{", "auditMsg", "=", "getPatientParticipantObjectIdentificationForResponse(request,", "auditMsg);", "try", "{", "auditMsg", "=", "getQueryParamsParticipantObjectIdentificationForResponse(request,", "auditMsg);", "}", "catch", "(JAXBException", "ex)", "{", "<START>", "if", "(LOG.isDebugEnabled())", "{", "<END>", "LOG.error(\"Error", "while", "creating", "ParticipantObjectIdentificationQueryByParameters", "segment", ":", "\"", "+", "ex.getLocalizedMessage(),", "ex);", "}", "}", "return", "auditMsg;", "}</code><technical_language>Remove", "this", "\"if\"", "statement.", "said,", "a", "for", "future", "reference:", "1.", "\"is[Level]Enabled\"", "check", "specific", "level", "(e.g.,", "if", "log", "trace,", "check", "\"isTraceEnabled()\",", "\"isDebugEnabled\").", "2.", "is", "\"isErrorEnabled\"", "--", "disable", "logging", "altogether,", "enabled.", "I", "suppose", "\"isEnabledFor(Level.ERROR)\",", "checking", "if", "logging", "is", "all.", "3.", "a", "rule", "of", "thumb,", "logging", "operation", "is", "extremely", "heavy", "(e.g.,", "transforming", "a", "large", "object", "for", "trace", "logs),", "want", "check", "if", "\"Info\"", "level", "enabled,", "higher", "(debug,", "trace)</technical_language>" ]
[ "protected", "AuditMessageType", "getParticipantObjectIdentificationForRequest(PRPAIN201306UV02", "request,", "AssertionType", "assertion,", "AuditMessageType", "auditMsg)", "{", "auditMsg", "=", "getPatientParticipantObjectIdentificationForResponse(request,", "auditMsg);", "try", "{", "auditMsg", "=", "getQueryParamsParticipantObjectIdentificationForResponse(request,", "auditMsg);", "}", "catch", "(JAXBException", "ex)", "{", "LOG.error(\"Error", "while", "creating", "ParticipantObjectIdentificationQueryByParameters", "segment", ":", "\"", "+", "ex.getLocalizedMessage(),", "ex);", "}", "return", "auditMsg;", "}" ]
[ "<code>private", "synchronized", "void", "addNode(DiscoveryDruidNode", "druidNode)", "{", "<START>", "DiscoveryDruidNode", "prev", "=", "nodes.put(druidNode.getDruidNode().getHostAndPortToUse(),", "druidNode);", "<END>", "if", "(prev", "==", "null)", "{", "for", "(DruidNodeDiscovery.Listener", "l", ":", "nodeListeners)", "{", "listenerExecutor.submit(()", "->", "{", "try", "{", "l.nodeAdded(druidNode);", "}", "catch", "(Exception", "ex)", "{", "log.error(ex,", "\"Exception", "occured", "in", "DiscoveryDruidNode.nodeAdded(node=[%s])", "in", "listener", "[%s].\",", "druidNode,", "l);", "}", "});", "}", "}", "else", "{", "log.warn(\"Node[%s]", "discovered", "but", "existed", "already", "[%s].\",", "druidNode,", "prev);", "}", "}</code><technical_language>is", "getDruidNode()", "getHostAndPortToUse()", "null</technical_language>" ]
[ "private", "void", "addNode(DiscoveryDruidNode", "druidNode)", "{", "synchronized", "(lock)", "{", "DiscoveryDruidNode", "prev", "=", "nodes.putIfAbsent(druidNode.getDruidNode().getHostAndPortToUse(),", "druidNode);", "if", "(prev", "==", "null)", "{", "for", "(DruidNodeDiscovery.Listener", "l", ":", "nodeListeners)", "{", "listenerExecutor.submit(()", "->", "{", "try", "{", "l.nodeAdded(druidNode);", "}", "catch", "(Exception", "ex)", "{", "log.error(", "ex,", "\"Exception", "occured", "in", "DiscoveryDruidNode.nodeAdded(node=[%s])", "in", "listener", "[%s].\",", "druidNode,", "l", ");", "}", "});", "}", "}", "else", "{", "log.warn(\"Node[%s]", "discovered", "but", "existed", "already", "[%s].\",", "druidNode,", "prev);", "}", "}", "}" ]
[ "<code>public", "Step", "variantsLoadStep()", "throws", "Exception", "{", "<START>", "return", "stepBuilderFactory.get(LOAD_VARIANTS).<Variant,", "Variant>chunk(10)", "<END>", ".reader(reader)", ".writer(variantMongoWriter)", ".faultTolerant().skipLimit(50).skip(FlatFileParseException.class)", ".listener(new", "SkippedItemListener())", ".build();", "}</code><technical_language>talked", "setting", "a", "chunk", "size.", "1000", "set", "in", "JobOptions?", "happy", "location", "other", "includeSrc,", "compressGenotypes,", "etc,", "too</technical_language>" ]
[ "public", "Step", "variantsLoadStep()", "throws", "Exception", "{", "return", "stepBuilderFactory.get(LOAD_VARIANTS)", ".<Variant,", "Variant>chunk(jobOptions.getPipelineOptions().getInt(JobParametersNames.CONFIG_CHUNK_SIZE))", ".reader(reader)", ".writer(variantMongoWriter)", ".faultTolerant().skipLimit(50).skip(FlatFileParseException.class)", ".listener(new", "SkippedItemListener())", ".build();", "}" ]
[ "<code><START>", "public", "int", "hashCode()", "<END>", "{", "int", "result", "=", "name", "!=", "null", "?", "name.hashCode()", ":", "0;", "result", "=", "31", "*", "result", "+", "zScore.hashCode();", "return", "result;", "}</code><technical_language>Please", "implement", "equals()", "method", "either.", "This", "remove", "potential", "problem", "working", "collections</technical_language>" ]
[ "public", "int", "hashCode()", "{", "int", "result", "=", "name.hashCode();", "result", "=", "31", "*", "result", "+", "zScore.hashCode();", "return", "result;", "}" ]
[ "<code>public", "Object", "execute(final", "ExecutionEvent", "event)", "throws", "ExecutionException", "{", "final", "TaskData", "data", "=", "getTaskData(event);", "if", "(data", "==", "null)", "return", "null;", "Job", "job", "=", "new", "Job(MessageFormat.format(", "Messages.RebasePullRequestHandler_RebaseJob,", "data.getTaskId()))", "{", "@Override", "protected", "IStatus", "run(IProgressMonitor", "monitor)", "{", "PullRequestComposite", "prComp", "=", "PullRequestConnector", ".getPullRequest(data);", "if", "(prComp", "==", "null)", "return", "Status.CANCEL_STATUS;", "PullRequest", "request", "=", "prComp.getRequest();", "Repository", "repo", "=", "PullRequestUtils.getRepository(request);", "if", "(repo", "==", "null)", "return", "Status.CANCEL_STATUS;", "String", "branchName", "=", "PullRequestUtils.getBranchName(request);", "try", "{", "String", "target", "=", "request.getBase().getRef();", "Ref", "targetRef", "=", "repo.findRef(request.getBase().getRef());", "if", "(targetRef", "!=", "null)", "{", "<START>", "SubMonitor", "progress", "=", "SubMonitor.convert(monitor,", "2);", "<END>", "if", "(!PullRequestUtils.isCurrentBranch(branchName,", "repo))", "{", "monitor.setTaskName(MessageFormat", ".format(Messages.RebasePullRequestHandler_TaskCheckout,", "branchName));", "BranchOperationUI.checkout(repo,", "branchName).run(", "progress.split(1));", "}", "else", "{", "progress.setWorkRemaining(1);", "}", "monitor.setTaskName(MessageFormat.format(", "Messages.RebasePullRequestHandler_TaskRebase,", "branchName,", "target));", "new", "RebaseOperation(repo,", "targetRef)", ".execute(progress.split(1));", "executeCallback(event);", "}", "}", "catch", "(IOException", "e)", "{", "GitHubUi.logError(e);", "}", "catch", "(CoreException", "e)", "{", "GitHubUi.logError(e);", "}", "return", "Status.OK_STATUS;", "}", "};", "schedule(job,", "event);", "return", "null;", "}</code><technical_language>more", "progress", "monitor", "change</technical_language>" ]
[ "public", "Object", "execute(final", "ExecutionEvent", "event)", "throws", "ExecutionException", "{", "final", "TaskData", "data", "=", "getTaskData(event);", "if", "(data", "==", "null)", "return", "null;", "Job", "job", "=", "new", "Job(MessageFormat.format(", "Messages.RebasePullRequestHandler_RebaseJob,", "data.getTaskId()))", "{", "protected", "IStatus", "run(IProgressMonitor", "monitor)", "{", "PullRequestComposite", "prComp", "=", "PullRequestConnector", ".getPullRequest(data);", "if", "(prComp", "==", "null)", "return", "Status.CANCEL_STATUS;", "PullRequest", "request", "=", "prComp.getRequest();", "Repository", "repo", "=", "PullRequestUtils.getRepository(request);", "if", "(repo", "==", "null)", "return", "Status.CANCEL_STATUS;", "String", "branchName", "=", "PullRequestUtils.getBranchName(request);", "try", "{", "String", "target", "=", "request.getBase().getRef();", "Ref", "targetRef", "=", "repo.findRef(request.getBase().getRef());", "if", "(targetRef", "!=", "null)", "{", "if", "(!PullRequestUtils.isCurrentBranch(branchName,", "repo))", "{", "monitor.setTaskName(MessageFormat", ".format(Messages.RebasePullRequestHandler_TaskCheckout,", "branchName));", "BranchOperationUI.checkout(repo,", "branchName).run(", "new", "SubProgressMonitor(monitor,", "1));", "}", "monitor.setTaskName(MessageFormat.format(", "Messages.RebasePullRequestHandler_TaskRebase,", "branchName,", "target));", "new", "RebaseOperation(repo,", "targetRef)", ".execute(new", "SubProgressMonitor(monitor,", "1));", "executeCallback(event);", "}", "}", "catch", "(IOException", "e)", "{", "GitHubUi.logError(e);", "}", "catch", "(CoreException", "e)", "{", "GitHubUi.logError(e);", "}", "return", "Status.OK_STATUS;", "}", "};", "schedule(job,", "event);", "return", "null;", "}" ]
[ "<code>public", "boolean", "process(Set<?", "extends", "TypeElement>", "annotations,", "RoundEnvironment", "roundEnv)", "{", "try", "{", "for", "(Element", "autoMountElement", ":", "roundEnv.getElementsAnnotatedWith(SecureAutoMount.class))", "{", "final", "AutoMountContext", "context", "=", "getAutoMountContext(autoMountElement,", "SecureAutoMount.class);", "if", "(context", "==", "null)", "{", "continue;", "}", "for", "(Element", "elem", ":", "roundEnv.getElementsAnnotatedWith(AuthorizeInstantiation.class))", "{", "final", "AuthorizeInstantiation", "mp", "=", "elem.getAnnotation(AuthorizeInstantiation.class);", "processMountPoint(context,", "elem,", "mp);", "}", "for", "(Element", "elem", ":", "roundEnv.getElementsAnnotatedWith(MountPath.class))", "{", "final", "MountPath", "mp", "=", "elem.getAnnotation(MountPath.class);", "processMountPoint(context,", "elem,", "mp);", "}", "generateSource(context);", "}", "return", "true;", "}", "catch", "(IOException", "ex)", "{", "<START>", "Logger.getLogger(SecureMountAnnotationProcessor.class.getName()).log(Level.SEVERE,", "null,", "ex);", "<END>", "}", "return", "true;", "}</code><technical_language>return", "false</technical_language>" ]
[ "public", "boolean", "process(Set<?", "extends", "TypeElement>", "annotations,", "RoundEnvironment", "roundEnv)", "{", "try", "{", "for", "(Element", "autoMountElement", ":", "roundEnv.getElementsAnnotatedWith(SecureAutoMount.class))", "{", "final", "AutoMountContext", "context", "=", "getAutoMountContext(autoMountElement,", "SecureAutoMount.class);", "if", "(context", "==", "null)", "{", "continue;", "}", "for", "(Element", "elem", ":", "roundEnv.getElementsAnnotatedWith(AuthorizeInstantiation.class))", "{", "final", "AuthorizeInstantiation", "mp", "=", "elem.getAnnotation(AuthorizeInstantiation.class);", "processMountPoint(context,", "elem,", "mp);", "}", "for", "(Element", "elem", ":", "roundEnv.getElementsAnnotatedWith(MountPath.class))", "{", "final", "MountPath", "mp", "=", "elem.getAnnotation(MountPath.class);", "processMountPoint(context,", "elem,", "mp);", "}", "generateSource(context);", "}", "}", "catch", "(IOException", "ex)", "{", "Logger.getLogger(SecureMountAnnotationProcessor.class.getName()).log(Level.SEVERE,", "null,", "ex);", "}", "return", "true;", "}" ]
[ "<code><START>", "public", "void", "testFrameworkProducerDelete()", "throws", "Exception", "{", "<END>", "setupFrameworkProducer(false);", "Exchange", "mockExchangeCreate", "=", "mock(Exchange.class);", "Exchange", "mockExchangeDelete", "=", "mock(Exchange.class);", "Message", "message", "=", "mock(Message.class);", "Metacard", "metacard", "=", "mock(MetacardImpl.class);", "when(metacard.getId()).thenReturn(\"metacard1\");", "when(mockExchangeCreate.getIn()).thenReturn(message);", "when(mockExchangeCreate.getOut()).thenReturn(message);", "when(mockExchangeCreate.getIn().getHeader(OPERATION_HEADER_KEY)).thenReturn(CREATE_OPERATION);", "when(mockExchangeCreate.getIn().getHeader(TIMEOUT_HEADER_KEY)).thenReturn(1000L);", "when(mockExchangeCreate.getIn().getBody()).thenReturn(metacard);", "when(mockExchangeCreate.getIn().getBody(any())).thenReturn(metacard);", "frameworkProducer.process(mockExchangeCreate);", "when(mockExchangeDelete.getIn()).thenReturn(message);", "when(mockExchangeDelete.getOut()).thenReturn(message);", "when(mockExchangeDelete.getIn().getHeader(OPERATION_HEADER_KEY)).thenReturn(DELETE_OPERATION);", "when(mockExchangeDelete.getIn().getHeader(TIMEOUT_HEADER_KEY)).thenReturn(1000L);", "}</code><technical_language>This", "test", "needs", "a", "verification</technical_language>" ]
[ "public", "void", "testFrameworkProducerDelete()", "throws", "Exception", "{", "setupFrameworkProducer(false);", "Exchange", "mockExchangeDelete", "=", "mock(Exchange.class);", "Message", "message", "=", "mock(Message.class);", "List", "ids", "=", "Collections.singletonList(\"metacardId\");", "when(message.getBody()).thenReturn(ids);", "when(message.getBody(any())).thenReturn(ids);", "when(mockExchangeDelete.getIn()).thenReturn(message);", "when(mockExchangeDelete.getOut()).thenReturn(message);", "when(mockExchangeDelete.getIn().getHeader(OPERATION_HEADER_KEY)).thenReturn(DELETE_OPERATION);", "when(mockExchangeDelete.getIn().getHeader(TIMEOUT_HEADER_KEY)).thenReturn(1000L);", "DeleteResponse", "response", "=", "mock(DeleteResponse.class);", "when(response.getDeletedMetacards()).thenReturn(Collections.singletonList(new", "MetacardImpl()));", "when(catalogFramework.delete(any())).thenReturn(response);", "frameworkProducer.process(mockExchangeDelete);", "verify(catalogFramework).delete(any(DeleteRequest.class));", "}" ]
[ "<code>protected", "void", "onCreate(Bundle", "savedInstanceState)", "{", "Log.d(TAG,", "\"onCreate\");", "requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);", "requestWindowFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);", "super.onCreate(savedInstanceState);", "PreferencesState.getInstance().onCreateActivityPreferences(getResources(),", "getTheme());", "if", "(EyeSeeTeaApplication.permissions", "==", "null)", "{", "EyeSeeTeaApplication.permissions", "=", "Permissions.getInstance(this);", "}", "if", "(!EyeSeeTeaApplication.permissions.areAllPermissionsGranted())", "{", "EyeSeeTeaApplication.permissions.requestNextPermission();", "}", "initView(savedInstanceState);", "PreferencesState.getInstance().setPushInProgress(false);", "List<SurveyDB>", "surveyDBs", "=", "SurveyDB.getAllSendingSurveys();", "Log.d(TAG,", "\"Surveys", "sending:", "\"", "+", "surveyDBs.size());", "for", "(SurveyDB", "surveyDB", ":", "surveyDBs)", "{", "surveyDB.setStatus(Constants.SURVEY_QUARANTINE);", "surveyDB.save();", "}", "<START>", "AlarmPushReceiver.setPushAlarm(this);", "<END>", "AlarmPushReceiver.setPushAlarm(this);", "AlarmPushReceiver.setPushAlarm(this);", "AlarmPushReceiver.setPushAlarm(this);", "try", "{", "Thread.sleep(100);", "AlarmPushReceiver.setPushAlarm(this);", "AlarmPushReceiver.setPushAlarm(this);", "Thread.sleep(100);", "AlarmPushReceiver.setPushAlarm(this);", "AlarmPushReceiver.setPushAlarm(this);", "Thread.sleep(100);", "AlarmPushReceiver.setPushAlarm(this);", "AlarmPushReceiver.setPushAlarm(this);", "}", "catch", "(InterruptedException", "e)", "{", "e.printStackTrace();", "}", "mBaseActivityStrategy.onCreate();", "}</code><technical_language>this", "code", "is", "strange,", "explain", "is", "necessary</technical_language>" ]
[ "protected", "void", "onCreate(Bundle", "savedInstanceState)", "{", "Log.d(TAG,", "\"onCreate\");", "requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);", "requestWindowFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);", "super.onCreate(savedInstanceState);", "PreferencesState.getInstance().onCreateActivityPreferences(getResources(),", "getTheme());", "if", "(EyeSeeTeaApplication.permissions", "==", "null)", "{", "EyeSeeTeaApplication.permissions", "=", "Permissions.getInstance(this);", "}", "if", "(!EyeSeeTeaApplication.permissions.areAllPermissionsGranted())", "{", "EyeSeeTeaApplication.permissions.requestNextPermission();", "}", "initView(savedInstanceState);", "PreferencesState.getInstance().setPushInProgress(false);", "List<SurveyDB>", "surveyDBs", "=", "SurveyDB.getAllSendingSurveys();", "Log.d(TAG,", "\"Surveys", "sending:", "\"", "+", "surveyDBs.size());", "for", "(SurveyDB", "surveyDB", ":", "surveyDBs)", "{", "surveyDB.setStatus(Constants.SURVEY_QUARANTINE);", "surveyDB.save();", "}", "AlarmPushReceiver.setPushAlarm(this);", "mBaseActivityStrategy.onCreate();", "}" ]
[ "<code>public", "void", "testProcessNonJavaFilesWithoutException()", "throws", "Exception", "{", "final", "TreeWalker", "treeWalker", "=", "new", "TreeWalker();", "treeWalker.setTabWidth(1);", "treeWalker.configure(new", "DefaultConfiguration(\"default", "config\"));", "final", "File", "file", "=", "new", "File(\"src/main/resources/checkstyle_packages.xml\");", "final", "FileText", "fileText", "=", "new", "FileText(file,", "StandardCharsets.ISO_8859_1.name());", "try", "{", "treeWalker.processFiltered(file,", "fileText);", "}", "catch", "(CheckstyleException", "ex)", "{", "<START>", "fail(\"Exception", "not", "expected\");", "<END>", "}", "}</code><technical_language>I", "mentioned", "others,", "try-catch-fail", "is", "a", "good", "option.", "JUnit", "automatically", "populates", "exception", "user", "fails", "test.", "If", "exception", "occurs,", "user", "get", "a", "bland", "message", "stack", "trace", "of", "problem.", "is", "assert", "here</technical_language>" ]
[ "public", "void", "testProcessNonJavaFilesWithoutException()", "throws", "Exception", "{", "final", "TreeWalker", "treeWalker", "=", "new", "TreeWalker();", "treeWalker.setTabWidth(1);", "treeWalker.configure(new", "DefaultConfiguration(\"default", "config\"));", "final", "File", "file", "=", "new", "File(\"src/main/resources/checkstyle_packages.xml\");", "final", "FileText", "fileText", "=", "new", "FileText(file,", "StandardCharsets.ISO_8859_1.name());", "treeWalker.processFiltered(file,", "fileText);", "final", "Collection<Checks>", "checks", "=", "(Collection<Checks>)", "Whitebox.getInternalState(treeWalker,", "\"ordinaryChecks\");", "assertTrue(\"No", "checks", "->", "No", "parsing\",", "checks.isEmpty());", "}" ]
[ "<code>protected", "void", "executeCommand()", "{", "final", "AuthenticationProfile", "profile", "=", "AuthenticationProfileRepository.getInstance()", ".getProfile(getParameters().getProfileName());", "sourceIp", "=", "getParameters().getSourceIp();", "if", "(profile", "==", "null)", "{", "setSucceeded(false);", "}", "else", "{", "<START>", "final", "boolean", "externalSsoEnabled", "=", "EngineLocalConfig.getInstance().getBoolean(\"ENGINE_SSO_ENABLE_EXTERNAL_SSO\");", "<END>", "final", "DbUser", "user", "=", "buildUser(externalSsoEnabled,", "getParameters(),", "profile.getAuthzName());", "boolean", "isAdmin", "=", "!roleDao.getAnyAdminRoleForUserAndGroups(user.getId(),", "StringUtils.join(user.getGroupIds(),", "\",\")).isEmpty();", "user.setAdmin(isAdmin);", "setCurrentUser(user);", "setUserName(String.format(\"%s@%s\",", "getCurrentUser().getLoginName(),", "getCurrentUser().getDomain()));", "if", "(getParameters().isAdminRequired()", "&&", "!isAdmin)", "{", "setSucceeded(false);", "}", "else", "if", "(permissionDao.getEntityPermissionsForUserAndGroups(user.getId(),", "StringUtils.join(user.getGroupIds(),", "\",\"),", "ActionGroup.LOGIN,", "BOTTOM_OBJECT_ID,", "VdcObjectType.Bottom,", "true)", "==", "null)", "{", "setSucceeded(false);", "}", "else", "{", "String", "engineSessionId", "=", "sessionDataContainer.generateEngineSessionId();", "sessionDataContainer.setSourceIp(engineSessionId,", "getParameters().getSourceIp());", "sessionDataContainer.setUser(engineSessionId,", "user);", "sessionDataContainer.refresh(engineSessionId);", "sessionDataContainer.setProfile(engineSessionId,", "profile);", "sessionDataContainer.setPrincipalName(engineSessionId,", "getParameters().getPrincipalName());", "sessionDataContainer.setSsoAccessToken(engineSessionId,", "getParameters().getSsoToken());", "sessionDataContainer.setSsoOvirtAppApiScope(engineSessionId,", "getParameters().getAppScope());", "getReturnValue().setActionReturnValue(engineSessionId);", "setSucceeded(true);", "sessionId", "=", "engineSessionId;", "}", "}", "}</code><technical_language>method", "nicer:", "buildUser(T", "params,", "String", "authzName)", "{", "boolean", "externalSsoEnabled", "=", "EngineLocalConfig.getInstance().getBoolean(\"ENGINE_SSO_ENABLE_EXTERNAL_SSO\");", "buildUser(externalSsoEnabled", ",", "params,", "authzName)", "{", "}</technical_language>" ]
[ "protected", "void", "executeCommand()", "{", "final", "AuthenticationProfile", "profile", "=", "AuthenticationProfileRepository.getInstance()", ".getProfile(getParameters().getProfileName());", "sourceIp", "=", "getParameters().getSourceIp();", "if", "(profile", "==", "null)", "{", "setSucceeded(false);", "}", "else", "{", "final", "DbUser", "user", "=", "buildUser(getParameters(),", "profile.getAuthzName());", "boolean", "isAdmin", "=", "!roleDao.getAnyAdminRoleForUserAndGroups(user.getId(),", "StringUtils.join(user.getGroupIds(),", "\",\")).isEmpty();", "user.setAdmin(isAdmin);", "setCurrentUser(user);", "setUserName(String.format(\"%s@%s\",", "getCurrentUser().getLoginName(),", "getCurrentUser().getDomain()));", "if", "(getParameters().isAdminRequired()", "&&", "!isAdmin)", "{", "setSucceeded(false);", "}", "else", "if", "(permissionDao.getEntityPermissionsForUserAndGroups(user.getId(),", "StringUtils.join(user.getGroupIds(),", "\",\"),", "ActionGroup.LOGIN,", "BOTTOM_OBJECT_ID,", "VdcObjectType.Bottom,", "true)", "==", "null)", "{", "setSucceeded(false);", "}", "else", "{", "String", "engineSessionId", "=", "sessionDataContainer.generateEngineSessionId();", "sessionDataContainer.setSourceIp(engineSessionId,", "getParameters().getSourceIp());", "sessionDataContainer.setUser(engineSessionId,", "user);", "sessionDataContainer.refresh(engineSessionId);", "sessionDataContainer.setProfile(engineSessionId,", "profile);", "sessionDataContainer.setPrincipalName(engineSessionId,", "getParameters().getPrincipalName());", "sessionDataContainer.setSsoAccessToken(engineSessionId,", "getParameters().getSsoToken());", "sessionDataContainer.setSsoOvirtAppApiScope(engineSessionId,", "getParameters().getAppScope());", "getReturnValue().setActionReturnValue(engineSessionId);", "setSucceeded(true);", "sessionId", "=", "engineSessionId;", "}", "}", "}" ]
[ "<code>private", "void", "closeConfirmationWindow()", "{", "if(getConfirmWindow()", "==", "null)", "{", "return;", "}", "else", "{", "setConfirmWindow(null);", "<START>", "}", "<END>", "}</code><technical_language>do", "setConfirmWindow(null);", "method</technical_language>" ]
[ "private", "void", "closeConfirmationWindow()", "{", "setConfirmWindow(null);", "}" ]
[ "<code>public", "void", "queryFile1Contributors()", "{", "final", "IFileHistory", "history", "=", "historyProvider.getFileHistoryFor(iFile1,", "IFileHistoryProvider.NONE,", "new", "NullProgressMonitor());", "assertNotNull(history);", "final", "IFileRevision[]", "revisions", "=", "history.getFileRevisions();", "IFileRevision", "branchFileRevision1", "=", "null;", "IFileRevision", "masterFileRevision3", "=", "null;", "IFileRevision", "masterFileRevision1", "=", "null;", "for", "(IFileRevision", "revision", ":", "revisions)", "{", "final", "String", "revisionId", "=", "revision.getContentIdentifier();", "<START>", "if", "(branchCommit1.getName().equals(revisionId))", "{", "<END>", "branchFileRevision1", "=", "revision;", "}", "else", "if", "(masterCommit3.getName().equals(revisionId))", "{", "masterFileRevision3", "=", "revision;", "}", "else", "if", "(masterCommit1.getName().equals(revisionId))", "{", "masterFileRevision1", "=", "revision;", "}", "}", "assertNotNull(branchFileRevision1);", "assertNotNull(masterFileRevision3);", "assertNotNull(masterFileRevision1);", "final", "IFileRevision[]", "branchCommit1Parents", "=", "history.getContributors(branchFileRevision1);", "assertEquals(1,", "branchCommit1Parents.length);", "assertRevisionMatchCommit(branchCommit1Parents[0],", "masterCommit1);", "final", "IFileRevision[]", "masterCommit3Parents", "=", "history", ".getContributors(masterFileRevision3);", "assertEquals(1,", "masterCommit3Parents.length);", "assertRevisionMatchCommit(masterCommit3Parents[0],", "masterCommit1);", "final", "IFileRevision[]", "masterCommit1Parents", "=", "history", ".getContributors(masterFileRevision1);", "assertEquals(0,", "masterCommit1Parents.length);", "}</code><technical_language>braces", "single", "line", "blocks,", "more", "occurrences", "in", "this", "patch</technical_language>" ]
[ "public", "void", "queryFile1Contributors()", "{", "final", "IFileHistory", "history", "=", "historyProvider.getFileHistoryFor(iFile1,", "IFileHistoryProvider.NONE,", "new", "NullProgressMonitor());", "assertNotNull(history);", "final", "IFileRevision[]", "revisions", "=", "history.getFileRevisions();", "IFileRevision", "branchFileRevision1", "=", "null;", "IFileRevision", "masterFileRevision3", "=", "null;", "IFileRevision", "masterFileRevision1", "=", "null;", "for", "(IFileRevision", "revision", ":", "revisions)", "{", "final", "String", "revisionId", "=", "revision.getContentIdentifier();", "if", "(branchCommit1.getName().equals(revisionId))", "branchFileRevision1", "=", "revision;", "else", "if", "(masterCommit3.getName().equals(revisionId))", "masterFileRevision3", "=", "revision;", "else", "if", "(masterCommit1.getName().equals(revisionId))", "masterFileRevision1", "=", "revision;", "}", "assertNotNull(branchFileRevision1);", "assertNotNull(masterFileRevision3);", "assertNotNull(masterFileRevision1);", "final", "IFileRevision[]", "branchCommit1Parents", "=", "history", ".getContributors(branchFileRevision1);", "assertEquals(1,", "branchCommit1Parents.length);", "assertRevisionMatchCommit(branchCommit1Parents[0],", "masterCommit1);", "final", "IFileRevision[]", "masterCommit3Parents", "=", "history", ".getContributors(masterFileRevision3);", "assertEquals(1,", "masterCommit3Parents.length);", "assertRevisionMatchCommit(masterCommit3Parents[0],", "masterCommit1);", "final", "IFileRevision[]", "masterCommit1Parents", "=", "history", ".getContributors(masterFileRevision1);", "assertEquals(0,", "masterCommit1Parents.length);", "}" ]
[ "<code>protected", "void", "onCreate(Bundle", "savedInstanceState)", "{", "super.onCreate(savedInstanceState);", "<START>", "finishIfNotRoot();", "<END>", "if", "(savedInstanceState", "!=", "null)", "{", "wasExternal", "=", "savedInstanceState.getBoolean(\"was_external\");", "}", "ACRAUtil.registerAppData();", "uiController", "=", "new", "HomeActivityUIController(this);", "uiController.setupUI();", "}</code><technical_language>this", "bail", "this", "call", "if", "root,", "returning", "v.", "returning", "onCreate()", "in", "case", "affect", "anything</technical_language>" ]
[ "protected", "void", "onCreate(Bundle", "savedInstanceState)", "{", "super.onCreate(savedInstanceState);", "if", "(finishIfNotRoot())", "{", "return;", "}", "if", "(savedInstanceState", "!=", "null)", "{", "wasExternal", "=", "savedInstanceState.getBoolean(\"was_external\");", "}", "ACRAUtil.registerAppData();", "uiController", "=", "new", "HomeActivityUIController(this);", "}" ]
[ "<code>public", "void", "testCheckoutExistingBranch()", "throws", "Exception", "{", "Git", "git", "=", "new", "Git(db);", "writeTrashFile(\"a\",", "\"Hello", "world", "a\");", "git.add().addFilepattern(\".\").call();", "git.commit().setMessage(\"commit", "file", "a\").call();", "git.branchCreate().setName(\"branch_1\").call();", "git.rm().addFilepattern(\"a\").call();", "FileUtils.mkdirs(new", "File(db.getWorkTree(),", "\"a\"));", "writeTrashFile(\"a/b\",", "\"Hello", "world", "b\");", "<START>", "git.add().addFilepattern(\"a\").call();", "<END>", "git.commit().setMessage(\"commit", "folder", "a\").call();", "git.rm().addFilepattern(\"a\").call();", "writeTrashFile(\"a\",", "\"New", "Hello", "world", "a\");", "git.add().addFilepattern(\".\").call();", "assertEquals(", "\"error:", "Your", "local", "changes", "to", "the", "following", "files", "would", "be", "overwritten", "by", "checkout:\",", "execute(\"git", "checkout", "branch_1\"));", "}</code><technical_language>want", "add", "a/b</technical_language>" ]
[ "public", "void", "testCheckoutExistingBranch()", "throws", "Exception", "{", "Git", "git", "=", "new", "Git(db);", "writeTrashFile(\"a\",", "\"Hello", "world", "a\");", "git.add().addFilepattern(\".\").call();", "git.commit().setMessage(\"commit", "file", "a\").call();", "git.branchCreate().setName(\"branch_1\").call();", "git.rm().addFilepattern(\"a\").call();", "FileUtils.mkdirs(new", "File(db.getWorkTree(),", "\"a\"));", "writeTrashFile(\"a/b\",", "\"Hello", "world", "b\");", "git.add().addFilepattern(\"a/b\").call();", "git.commit().setMessage(\"commit", "folder", "a\").call();", "git.rm().addFilepattern(\"a\").call();", "writeTrashFile(\"a\",", "\"New", "Hello", "world", "a\");", "git.add().addFilepattern(\".\").call();", "assertEquals(", "\"error:", "Your", "local", "changes", "to", "the", "following", "files", "would", "be", "overwritten", "by", "checkout:\",", "execute(\"git", "checkout", "branch_1\"));", "}" ]
[ "<code>private", "String", "formRevertMessage(RevertResult", "revertResult)", "{", "StringBuilder", "message", "=", "new", "StringBuilder();", "if", "(revertResult.getNewHead()", "!=", "null)", "{", "message.append(constant.revertedNewHead(revertResult.getNewHead()));", "}", "List<String>", "commits", "=", "revertResult.getRevertedCommits();", "if", "(commits", "!=", "null", "&&", "commits.size()", ">", "0)", "{", "StringBuilder", "revertedCommits", "=", "new", "StringBuilder();", "for", "(String", "commit", ":", "commits)", "{", "<START>", "revertedCommits.append(\"", "\");", "<END>", "revertedCommits.append(commit);", "}", "message.append(", "revertedCommits.length()", ">", "0", "?", "\"", "\"", "+", "constant.revertedCommits(revertedCommits.toString())", ":", "\"\\n\");", "}", "return", "message.toString();", "}</code><technical_language>a", "bit", "clearer", "append", "chain", "here</technical_language>" ]
[ "private", "String", "formRevertMessage(RevertResult", "revertResult)", "{", "StringBuilder", "message", "=", "new", "StringBuilder();", "if", "(revertResult.getNewHead()", "!=", "null)", "{", "message.append(constant.revertedNewHead(revertResult.getNewHead()));", "}", "List<String>", "commits", "=", "revertResult.getRevertedCommits();", "if", "(commits", "!=", "null", "&&", "commits.size()", ">", "0)", "{", "StringBuilder", "revertedCommits", "=", "new", "StringBuilder();", "for", "(String", "commit", ":", "commits)", "{", "revertedCommits.append(\"", "\").append(commit);", "}", "message.append(", "revertedCommits.length()", ">", "0", "?", "\"", "\"", "+", "constant.revertedCommits(revertedCommits.toString())", ":", "\"\\n\");", "}", "return", "message.toString();", "}" ]
[ "<code><START>", "public", "static", "void", "init(Context", "context,", "String", "appDefinedUserAgent)", "{", "<END>", "String", "appId", "=", "\"unknown\";", "try", "{", "PackageInfo", "pi", "=", "context.getPackageManager().getPackageInfo(context.getPackageName(),", "0);", "appId", "=", "pi.packageName;", "}", "catch", "(Exception", "ignore)", "{", "}", "String", "userAgent", "=", "\"Unknown\";", "try", "{", "StringBuilder", "sb", "=", "new", "StringBuilder();", "sb.append(\"RealmJava/\");", "sb.append(BuildConfig.VERSION_NAME);", "sb.append(\"", "(\");", "sb.append(Util.isEmptyString(Build.DEVICE)", "?", "\"unknown-device\"", ":", "Build.DEVICE);", "sb.append(\",", "\");", "sb.append(Util.isEmptyString(Build.MODEL)", "?", "\"unknown-model\"", ":", "Build.MODEL);", "sb.append(\",", "v\");", "sb.append(Build.VERSION.SDK_INT);", "sb.append(\")\");", "if", "(!appDefinedUserAgent.isEmpty())", "{", "sb.append(\"", "\");", "sb.append(appDefinedUserAgent);", "}", "userAgent", "=", "sb.toString();", "}", "catch", "(Exception", "e)", "{", "RealmLog.warn(\"Constructing", "User-Agent", "description", "failed.\",", "e);", "}", "if", "(SyncManager.Debug.separatedDirForSyncManager)", "{", "try", "{", "File", "dir", "=", "File.createTempFile(\"remote_sync_\",", "\"_\"", "+", "android.os.Process.myPid(),", "context.getFilesDir());", "if", "(!dir.delete())", "{", "throw", "new", "IllegalStateException(String.format(Locale.US,", "\"Temp", "file", "'%s'", "cannot", "be", "deleted.\",", "dir.getPath()));", "}", "if", "(!dir.mkdir())", "{", "throw", "new", "IllegalStateException(String.format(Locale.US,", "\"Directory", "'%s'", "for", "SyncManager", "cannot", "be", "created.", "\",", "dir.getPath()));", "}", "SyncManager.nativeInitializeSyncManager(dir.getPath(),", "userAgent);", "}", "catch", "(IOException", "e)", "{", "throw", "new", "IllegalStateException(e);", "}", "}", "else", "{", "SyncManager.nativeInitializeSyncManager(context.getFilesDir().getPath(),", "userAgent);", "}", "UserStore", "userStore", "=", "new", "RealmFileUserStore();", "SyncManager.init(appId,", "userAgent,", "userStore);", "}</code><technical_language>overload", "varargs", "this", "parameter", "optional,", "so:", "1-", "break", "current", "API", "2-", "force", "user", "this", "parameter", "(especially", "in", "context", "of", "sync)</technical_language>" ]
[ "public", "static", "void", "init(Context", "context,", "String", "appDefinedUserAgent)", "{", "String", "appId", "=", "\"unknown\";", "try", "{", "PackageInfo", "pi", "=", "context.getPackageManager().getPackageInfo(context.getPackageName(),", "0);", "appId", "=", "pi.packageName;", "}", "catch", "(Exception", "ignore)", "{", "}", "String", "userAgent", "=", "\"Unknown\";", "try", "{", "StringBuilder", "sb", "=", "new", "StringBuilder();", "sb.append(\"RealmJava/\");", "sb.append(BuildConfig.VERSION_NAME);", "sb.append(\"", "(\");", "sb.append(Util.isEmptyString(Build.DEVICE)", "?", "\"unknown-device\"", ":", "Build.DEVICE);", "sb.append(\",", "\");", "sb.append(Util.isEmptyString(Build.MODEL)", "?", "\"unknown-model\"", ":", "Build.MODEL);", "sb.append(\",", "v\");", "sb.append(Build.VERSION.SDK_INT);", "sb.append(\")\");", "if", "(!Util.isEmptyString(appDefinedUserAgent))", "{", "sb.append(\"", "\");", "sb.append(appDefinedUserAgent);", "}", "userAgent", "=", "sb.toString();", "}", "catch", "(Exception", "e)", "{", "RealmLog.warn(\"Constructing", "User-Agent", "description", "failed.\",", "e);", "}", "if", "(SyncManager.Debug.separatedDirForSyncManager)", "{", "try", "{", "File", "dir", "=", "File.createTempFile(\"remote_sync_\",", "\"_\"", "+", "android.os.Process.myPid(),", "context.getFilesDir());", "if", "(!dir.delete())", "{", "throw", "new", "IllegalStateException(String.format(Locale.US,", "\"Temp", "file", "'%s'", "cannot", "be", "deleted.\",", "dir.getPath()));", "}", "if", "(!dir.mkdir())", "{", "throw", "new", "IllegalStateException(String.format(Locale.US,", "\"Directory", "'%s'", "for", "SyncManager", "cannot", "be", "created.", "\",", "dir.getPath()));", "}", "SyncManager.nativeInitializeSyncManager(dir.getPath(),", "userAgent);", "}", "catch", "(IOException", "e)", "{", "throw", "new", "IllegalStateException(e);", "}", "}", "else", "{", "SyncManager.nativeInitializeSyncManager(context.getFilesDir().getPath(),", "userAgent);", "}", "UserStore", "userStore", "=", "new", "RealmFileUserStore();", "SyncManager.init(appId,", "userStore);", "}" ]
[ "<code>private", "List<StoragePool>", "searchStoragePool()", "{", "Optional<Version>", "optionalVersion", "=", "Config.<HashSet<Version>>", "getValue(ConfigValues.SupportedClusterLevels).stream()", ".max(Comparator.naturalOrder());", "List<StoragePool>", "dataCenters", "=", "genericSearch(storagePoolDao,", "true);", "<START>", "optionalVersion.ifPresent(", "version", "->", "dataCenters.forEach(", "dataCenter", "->", "{", "dataCenter.setStoragePoolCompatibilityLevelUpgradeNeeded(", "version.compareTo(dataCenter.getCompatibilityVersion())", ">", "0);", "dataCenter.setMacPoolId(dcSingleMacPoolFinder.find(dataCenter.getId()));", "}", "));", "<END>", "return", "dataCenters;", "}</code><technical_language>I", "easier", "do", "check", "!ifPresent", "skip", "rest,", "instead", "of", "creating", "lambda.", "if", "2", "lambdas", "approach", "instead", "of", "if", "lambda,", "fine,", "extract", "method", "lambda,", "lambda", "in", "lambda", "...", "watching", "Inception", "again,", "forced", "watch", "that..</technical_language>" ]
[ "private", "List<StoragePool>", "searchStoragePool()", "{", "List<StoragePool>", "dataCenters", "=", "genericSearch(storagePoolDao,", "true);", "dataCenters.forEach(this::setDcSingleMacPoolId);", "setDcCompatibilityLevelUpgradeNeeded(dataCenters);", "return", "dataCenters;", "}" ]
[ "<code>public", "boolean", "save(final", "Tuple<String,", "LogicalPlan>", "tuple){", "final", "LogicalPlan", "plan", "=", "tuple.getValue();", "final", "String", "queryId", "=", "tuple.getKey();", "<START>", "final", "File", "storedPlanFile=", "new", "File(planFolderPath", "+", "queryId", "+", "\".plan\");", "<END>", "if", "(!storedPlanFile.exists())", "{", "final", "DataFileWriter<LogicalPlan>", "dataFileWriter", "=", "new", "DataFileWriter<LogicalPlan>(datumWriter);", "try", "{", "dataFileWriter.create(plan.getSchema(),", "storedPlanFile);", "dataFileWriter.append(plan);", "dataFileWriter.close();", "return", "true;", "}", "catch", "(final", "Exception", "e)", "{", "e.printStackTrace();", "}", "}", "return", "false;", "}</code><technical_language>File(planStorePath,", "queryId", "+", "\".plan\")</technical_language>" ]
[ "public", "boolean", "save(final", "Tuple<String,", "LogicalPlan>", "tuple)", "throws", "IOException", "{", "final", "LogicalPlan", "plan", "=", "tuple.getValue();", "final", "String", "queryId", "=", "tuple.getKey();", "final", "File", "storedPlanFile=", "new", "File(planStorePath,", "queryId", "+", "\".plan\");", "if", "(!storedPlanFile.exists())", "{", "final", "DataFileWriter<LogicalPlan>", "dataFileWriter", "=", "new", "DataFileWriter<LogicalPlan>(datumWriter);", "dataFileWriter.create(plan.getSchema(),", "storedPlanFile);", "dataFileWriter.append(plan);", "dataFileWriter.close();", "return", "true;", "}", "return", "false;", "}" ]
[ "<code>public", "void", "onMessage(NodeRegistrationContainerReport", "nodeRegistrationContainerReport,", "EventPublisher", "publisher)", "{", "if", "(chillModeManager.getInChillMode())", "{", "if", "(validate())", "{", "<START>", "chillModeManager.validateChillModeExitRules(publisher);", "<END>", "return;", "}", "}", "else", "{", "return;", "}", "process(nodeRegistrationContainerReport);", "if(chillModeManager.getInChillMode())", "{", "SCMChillModeManager.getLogger().info(", "\"SCM", "in", "chill", "mode.", "{}", "DataNodes", "registered,", "{}", "required.\",", "registeredDns,", "requiredDns);", "}", "if", "(validate())", "{", "chillModeManager.validateChillModeExitRules(publisher);", "return;", "}", "}</code><technical_language>process", "data", "this", "report", "validating", "again</technical_language>" ]
[ "public", "void", "onMessage(NodeRegistrationContainerReport", "nodeRegistrationContainerReport,", "EventPublisher", "publisher)", "{", "if", "(chillModeManager.getInChillMode())", "{", "if", "(validate())", "{", "return;", "}", "process(nodeRegistrationContainerReport);", "if", "(chillModeManager.getInChillMode())", "{", "SCMChillModeManager.getLogger().info(", "\"SCM", "in", "chill", "mode.", "{}", "DataNodes", "registered,", "{}", "required.\",", "registeredDns,", "requiredDns);", "}", "if", "(validate())", "{", "chillModeManager.validateChillModeExitRules(publisher);", "}", "}", "}" ]
[ "<code>protected", "int", "doWork()", "{", "initializeAggregationState();", "IOUtil.assertFileIsReadable(INPUT);", "IOUtil.assertFilesAreReadable(INTERVALS);", "final", "int", "returnValue;", "if", "(", "INTERVAL_ITERATOR", ")", "{", "returnValue", "=", "processDataIntervalIteration();", "}", "else", "{", "returnValue", "=", "processDataNormalIteration();", "}", "if", "(returnValue", "!=", "0)", "{", "return", "returnValue;", "}", "log.info(\"Iteration", "complete,", "generating", "metric", "files\");", "aggregatorList.forEach(this::writeMetricsFileForAggregator);", "log.info(String.format(\"Examined", "%d", "loci,", "Processed", "%d", "loci,", "Skipped", "%d", "loci.\\n\"", "+", "\"Computation", "took", "%d", "seconds.\",", "nTotalLoci,", "nProcessedLoci,", "nSkippedLoci,", "progressLogger.getElapsedSeconds()));", "<START>", "return", "returnValue;", "<END>", "}</code><technical_language>this", "point", "returnValue==0,", "change</technical_language>" ]
[ "protected", "int", "doWork()", "{", "initializeAggregationState();", "IOUtil.assertFileIsReadable(INPUT);", "IOUtil.assertFileIsReadable(VCF);", "IOUtil.assertFileIsReadable(REFERENCE_SEQUENCE);", "IOUtil.assertFilesAreReadable(INTERVALS);", "final", "int", "returnValue", "=", "processData();", "if", "(returnValue", "==", "0)", "{", "log.info(\"Iteration", "complete,", "generating", "metric", "files\");", "aggregatorList.forEach(this::writeMetricsFileForAggregator);", "log.info(String.format(\"Examined", "%d", "loci,", "Processed", "%d", "loci,", "Skipped", "%d", "loci.\\n\"", "+", "\"Computation", "took", "%d", "seconds.\",", "nTotalLoci,", "nProcessedLoci,", "nSkippedLoci,", "progressLogger.getElapsedSeconds()));", "}", "return", "returnValue;", "}" ]
[ "<code>private", "void", "setExecutionEnvironment(TargetPlatformConfiguration", "result,", "Xpp3Dom", "configuration)", "{", "String", "value", "=", "getStringValue(configuration.getChild(\"executionEnvironment\"));", "if", "(value", "==", "null)", "{", "return;", "}", "<START>", "if", "(value.startsWith(\"?\"))", "{", "<END>", "throw", "new", "RuntimeException(", "\"The", "target-platform-configuration", "parameter", "<executionEnvironment>", "must", "not", "start", "with", "a", "'?'.", "Use", "<defaultExecutionEnvironment>", "without", "a", "leading", "'?'", "instead.\");", "}", "try", "{", "ExecutionEnvironmentUtils.getExecutionEnvironment(value);", "}", "catch", "(UnknownEnvironmentException", "e)", "{", "throw", "new", "RuntimeException(\"Invalid", "execution", "environment", "profile", "name", "\"", "+", "value);", "}", "result.setExecutionEnvironment(value);", "}</code><technical_language>need", "this", "check.", "if", "\"?\"", "is", "somewhere,", "I", "doubt,", "UnknownEnvironmentException", "self-exlanatory", "enough", "for", "investigate", "fix", "it</technical_language>" ]
[ "private", "void", "setExecutionEnvironment(TargetPlatformConfiguration", "result,", "Xpp3Dom", "configuration)", "{", "String", "value", "=", "getStringValue(configuration.getChild(\"executionEnvironment\"));", "if", "(value", "==", "null)", "{", "return;", "}", "try", "{", "ExecutionEnvironmentUtils.getExecutionEnvironment(value);", "}", "catch", "(UnknownEnvironmentException", "e)", "{", "throw", "new", "RuntimeException(\"Invalid", "execution", "environment", "profile", "name", "\"", "+", "value);", "}", "result.setExecutionEnvironment(value);", "}" ]
[ "<code>public", "void", "onBindEvent(BindButtonEvent", "event)", "{", "if", "(event.getState().equals(ButtonState.DOWN)", "&&", "!SortOrderSystem.containsConsole())", "{", "if", "(event.getId().equals(new", "SimpleUri(\"engine:tabbingModifier\")))", "{", "shiftPressed", "=", "true;", "}", "if", "(event.getId().equals(new", "SimpleUri(\"engine:tabbingUI\")))", "{", "TabbingManager.focusSetThrough", "=", "true;", "if", "(shiftPressed)", "{", "TabbingManager.changeCurrentNum(false);", "}", "else", "{", "TabbingManager.changeCurrentNum(true);", "<START>", "}", "<END>", "for", "(WidgetWithOrder", "widget", ":", "TabbingManager.getWidgetsList())", "{", "if", "(widget.getOrder()", "==", "TabbingManager.getCurrentNum())", "{", "if", "(!widget.isEnabled())", "{", "TabbingManager.changeCurrentNum(true);", "}", "else", "{", "widget.onGainFocus();", "TabbingManager.focusedWidget", "=", "widget;", "TabbingManager.getOpenScreen().getManager().setFocus(widget);", "}", "}", "else", "{", "widget.onLoseFocus();", "if", "(widget", "instanceof", "UIRadialSection)", "{", "((UIRadialSection)", "widget).setSelected(false);", "}", "}", "}", "event.prepare(new", "SimpleUri(\"engine:tabbingUI\"),", "ButtonState.UP,", "event.getDelta());", "}", "else", "if", "(event.getId().equals(new", "SimpleUri(\"engine:activate\")))", "{", "if", "(TabbingManager.focusedWidget", "instanceof", "UIDropdown)", "{", "((UIDropdown)", "TabbingManager.focusedWidget).setOpenedReverse();", "}", "else", "if", "(TabbingManager.focusedWidget", "instanceof", "ActivateableWidget)", "{", "((ActivateableWidget)", "TabbingManager.focusedWidget).activateWidget();", "}", "event.prepare(new", "SimpleUri(\"engine:activate\"),", "ButtonState.UP,", "event.getDelta());", "}", "}", "if", "(event.getState().equals(ButtonState.UP)", "&&", "!SortOrderSystem.containsConsole())", "{", "if", "(event.getId().equals(new", "SimpleUri(\"engine:tabbingModifier\")))", "{", "shiftPressed", "=", "false;", "}", "}", "}</code><technical_language>replace", "this", "if", "with:", "java", "TabbingManager.changeCurrentNum(!shiftPressed);</technical_language>" ]
[ "public", "void", "onBindEvent(BindButtonEvent", "event)", "{", "if", "(event.getState().equals(ButtonState.DOWN)", "&&", "!SortOrderSystem.containsConsole())", "{", "if", "(event.getId().equals(new", "SimpleUri(\"engine:tabbingModifier\")))", "{", "shiftPressed", "=", "true;", "}", "if", "(event.getId().equals(new", "SimpleUri(\"engine:tabbingUI\")))", "{", "if", "(!TabbingManager.isInitialized())", "{", "TabbingManager.init();", "}", "TabbingManager.focusSetThrough", "=", "true;", "TabbingManager.changeCurrentNum(!shiftPressed);", "for", "(WidgetWithOrder", "widget", ":", "TabbingManager.getWidgetsList())", "{", "if", "(widget.getOrder()", "==", "TabbingManager.getCurrentNum())", "{", "if", "(!widget.isEnabled())", "{", "TabbingManager.changeCurrentNum(true);", "}", "else", "{", "widget.onGainFocus();", "TabbingManager.focusedWidget", "=", "widget;", "TabbingManager.getOpenScreen().getManager().setFocus(widget);", "}", "}", "else", "{", "widget.onLoseFocus();", "if", "(widget", "instanceof", "UIRadialSection)", "{", "((UIRadialSection)", "widget).setSelected(false);", "}", "}", "}", "event.prepare(new", "SimpleUri(\"engine:tabbingUI\"),", "ButtonState.UP,", "event.getDelta());", "}", "else", "if", "(event.getId().equals(new", "SimpleUri(\"engine:activate\")))", "{", "if", "(TabbingManager.focusedWidget", "instanceof", "UIDropdown)", "{", "((UIDropdown)", "TabbingManager.focusedWidget).setOpenedReverse();", "}", "else", "if", "(TabbingManager.focusedWidget", "instanceof", "ActivatableWidget)", "{", "((ActivatableWidget)", "TabbingManager.focusedWidget).activateWidget();", "}", "event.prepare(new", "SimpleUri(\"engine:activate\"),", "ButtonState.UP,", "event.getDelta());", "}", "}", "if", "(event.getState().equals(ButtonState.UP)", "&&", "!SortOrderSystem.containsConsole())", "{", "if", "(event.getId().equals(new", "SimpleUri(\"engine:tabbingModifier\")))", "{", "shiftPressed", "=", "false;", "}", "}", "}" ]
[ "<code>protected", "boolean", "corsRequest()", "{", "if", "(!deployment.isCors())", "return", "false;", "KeycloakSecurityContext", "securityContext", "=", "facade.getSecurityContext();", "String", "origin", "=", "facade.getRequest().getHeader(CorsHeaders.ORIGIN);", "String", "exposeHeaders", "=", "deployment.getCorsExposedHeaders();", "String", "requestOrigin", "=", "UriUtils.getOrigin(facade.getRequest().getURI());", "log.debugv(\"Origin:", "{0}", "uri:", "{1}\",", "origin,", "facade.getRequest().getURI());", "if", "(securityContext", "!=", "null", "&&", "origin", "!=", "null", "&&", "!origin.equals(requestOrigin))", "{", "AccessToken", "token", "=", "securityContext.getToken();", "Set<String>", "allowedOrigins", "=", "token.getAllowedOrigins();", "if", "(log.isDebugEnabled())", "{", "for", "(String", "a", ":", "allowedOrigins)", "log.debug(\"", "\"", "+", "a);", "}", "if", "(allowedOrigins", "==", "null", "||", "(!allowedOrigins.contains(\"*\")", "&&", "!allowedOrigins.contains(origin)))", "{", "if", "(allowedOrigins", "==", "null)", "{", "log.debugv(\"allowedOrigins", "was", "null", "in", "token\");", "}", "else", "{", "log.debugv(\"allowedOrigins", "did", "not", "contain", "origin\");", "}", "facade.getResponse().sendError(403);", "facade.getResponse().end();", "return", "true;", "}", "log.debugv(\"returning", "origin:", "{0}\",", "origin);", "facade.getResponse().setStatus(200);", "facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_ALLOW_ORIGIN,", "origin);", "facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS,", "\"true\");", "<START>", "facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_EXPOSE_HEADERS,", "exposeHeaders);", "<END>", "}", "else", "{", "log.debugv(\"cors", "validation", "not", "needed", "as", "we're", "not", "a", "secure", "session", "or", "origin", "header", "was", "null:", "{0}\",", "facade.getRequest().getURI());", "}", "return", "false;", "}</code><technical_language>set", "header", "if", "\"deployment.getCorsExposedHeaders()", "!=", "null\"</technical_language>" ]
[ "protected", "boolean", "corsRequest()", "{", "if", "(!deployment.isCors())", "return", "false;", "KeycloakSecurityContext", "securityContext", "=", "facade.getSecurityContext();", "String", "origin", "=", "facade.getRequest().getHeader(CorsHeaders.ORIGIN);", "String", "exposeHeaders", "=", "deployment.getCorsExposedHeaders();", "String", "requestOrigin", "=", "UriUtils.getOrigin(facade.getRequest().getURI());", "log.debugv(\"Origin:", "{0}", "uri:", "{1}\",", "origin,", "facade.getRequest().getURI());", "if", "(securityContext", "!=", "null", "&&", "origin", "!=", "null", "&&", "!origin.equals(requestOrigin))", "{", "AccessToken", "token", "=", "securityContext.getToken();", "Set<String>", "allowedOrigins", "=", "token.getAllowedOrigins();", "if", "(log.isDebugEnabled())", "{", "for", "(String", "a", ":", "allowedOrigins)", "log.debug(\"", "\"", "+", "a);", "}", "if", "(allowedOrigins", "==", "null", "||", "(!allowedOrigins.contains(\"*\")", "&&", "!allowedOrigins.contains(origin)))", "{", "if", "(allowedOrigins", "==", "null)", "{", "log.debugv(\"allowedOrigins", "was", "null", "in", "token\");", "}", "else", "{", "log.debugv(\"allowedOrigins", "did", "not", "contain", "origin\");", "}", "facade.getResponse().sendError(403);", "facade.getResponse().end();", "return", "true;", "}", "log.debugv(\"returning", "origin:", "{0}\",", "origin);", "facade.getResponse().setStatus(200);", "facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_ALLOW_ORIGIN,", "origin);", "facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS,", "\"true\");", "if", "(exposeHeaders", "!=", "null)", "{", "facade.getResponse().setHeader(CorsHeaders.ACCESS_CONTROL_EXPOSE_HEADERS,", "exposeHeaders);", "}", "}", "else", "{", "log.debugv(\"cors", "validation", "not", "needed", "as", "we're", "not", "a", "secure", "session", "or", "origin", "header", "was", "null:", "{0}\",", "facade.getRequest().getURI());", "}", "return", "false;", "}" ]
[ "<code>public", "void", "beforeSend(", "ServerSession", "session,", "Transaction", "tx,", "Message", "message,", "boolean", "direct,", "boolean", "noAutoCreateQueue)", "{", "try", "{", "if", "(brokerMessageInterceptor", "==", "null)", "{", "BundleContext", "bundleContext", "=", "getBundleContext();", "brokerMessageInterceptor", "=", "bundleContext.getService(", "((List<ServiceReference<BrokerMessageInterceptor>>)", "bundleContext.getServiceReferences(", "BrokerMessageInterceptor.class,", "\"(name=subjectInjectorPlugin)\"))", ".get(0));", "}", "brokerMessageInterceptor.handleMessage(session,", "tx,", "message,", "direct,", "noAutoCreateQueue);", "}", "catch", "(InvalidSyntaxException", "e)", "{", "<START>", "LOGGER.error(", "<END>", "\"Could", "retrieve", "the", "Subject", "Injector", "Plugin,", "subject", "will", "not", "be", "correctly", "applied", "to", "the", "message.\",", "e);", "}", "}</code><technical_language>Is", "error", "right", "log", "level", "here?", "warn", "info", "more", "appropriate</technical_language>" ]
[ "public", "void", "beforeSend(", "ServerSession", "session,", "Transaction", "tx,", "Message", "message,", "boolean", "direct,", "boolean", "noAutoCreateQueue)", "{", "try", "{", "if", "(brokerMessageInterceptor", "==", "null)", "{", "BundleContext", "bundleContext", "=", "getBundleContext();", "brokerMessageInterceptor", "=", "bundleContext.getService(", "((List<ServiceReference<BrokerMessageInterceptor>>)", "bundleContext.getServiceReferences(", "BrokerMessageInterceptor.class,", "\"(name=subjectInjectorPlugin)\"))", ".get(0));", "}", "brokerMessageInterceptor.handleMessage(session,", "tx,", "message,", "direct,", "noAutoCreateQueue);", "}", "catch", "(InvalidSyntaxException", "e)", "{", "LOGGER.warn(", "\"Could", "retrieve", "the", "Subject", "Injector", "Plugin,", "subject", "will", "not", "be", "correctly", "applied", "to", "the", "message.\",", "e);", "}", "}" ]
[ "<code>public", "void", "delete()", "throws", "IOException,", "InterruptedException", "{", "checkPermission(DELETE);", "FolderComputation<I>", "computation", "=", "getComputation();", "Executor", "executor", "=", "Executor.of(computation);", "if", "(executor", "!=", "null)", "{", "LOGGER.log(Level.INFO,", "\"Interrupting", "{0}", "in", "order", "to", "delete", "it\",", "this);", "executor.interrupt(Result.ABORTED,", "new", "CauseOfInterruption.UserInterruption(User.current()));", "long", "expiration", "=", "System.nanoTime()", "+", "TimeUnit.SECONDS.toNanos(15);", "while", "(executor.isAlive()", "<START>", "&&", "executor.getCurrentExecutable()", "==", "computation", "<END>", "&&", "expiration", "-", "System.nanoTime()", ">", "0L)", "{", "Thread.sleep(50L);", "}", "if", "(executor.isAlive()", "&&", "executor.getCurrentExecutable()", "==", "computation)", "{", "LOGGER.log(Level.WARNING,", "\"Interrupted", "{0}", "in", "order", "to", "delete", "it,", "but", "it", "has", "not", "stopped", "yet\",", "this);", "}", "}", "super.delete();", "}</code><technical_language>Superfluous", "check", "I", "think-it", "a", "long", "time", "Executors", "reused</technical_language>" ]
[ "public", "void", "delete()", "throws", "IOException,", "InterruptedException", "{", "checkPermission(DELETE);", "FolderComputation<I>", "computation", "=", "getComputation();", "Executor", "executor", "=", "Executor.of(computation);", "if", "(executor", "!=", "null)", "{", "LOGGER.log(Level.INFO,", "\"Interrupting", "{0}", "in", "order", "to", "delete", "it\",", "this);", "executor.interrupt(Result.ABORTED,", "new", "CauseOfInterruption.UserInterruption(User.current()));", "long", "expiration", "=", "System.nanoTime()", "+", "TimeUnit.SECONDS.toNanos(15);", "while", "(executor.isAlive()", "&&", "executor.getCurrentExecutable()", "==", "computation", "&&", "expiration", "-", "System.nanoTime()", ">", "0L)", "{", "Thread.sleep(50L);", "}", "if", "(executor.isAlive()", "&&", "executor.getCurrentExecutable()", "==", "computation)", "{", "throw", "new", "AbortException(\"Failed", "to", "stop", "computation", "of", "\"", "+", "getFullDisplayName());", "}", "}", "super.delete();", "}" ]
[ "<code>private", "void", "refreshLocalMessageFlags(final", "Account", "account,", "final", "Folder", "remoteFolder,", "final", "LocalFolder", "localFolder,", "ArrayList<Message>", "syncFlagMessages,", "final", "AtomicInteger", "progress,", "final", "int", "todo", ")", "throws", "MessagingException", "{", "final", "String", "folder", "=", "remoteFolder.getName();", "if", "(remoteFolder.supportsFetchingFlags())", "{", "if", "(K9.DEBUG)", "Log.d(K9.LOG_TAG,", "\"SYNC:", "About", "to", "sync", "flags", "for", "\"", "+", "syncFlagMessages.size()", "+", "\"", "remote", "messages", "for", "folder", "\"", "+", "folder);", "FetchProfile", "fp", "=", "new", "FetchProfile();", "fp.add(FetchProfile.Item.FLAGS);", "List<Message>", "undeletedMessages", "=", "new", "LinkedList<Message>();", "for", "(Message", "message", ":", "syncFlagMessages)", "{", "if", "(!message.isSet(Flag.DELETED))", "{", "undeletedMessages.add(message);", "}", "}", "remoteFolder.fetch(undeletedMessages.toArray(EMPTY_MESSAGE_ARRAY),", "fp,", "null);", "for", "(Message", "remoteMessage", ":", "syncFlagMessages)", "{", "Message", "localMessage", "=", "localFolder.getMessage(remoteMessage.getUid());", "boolean", "messageChanged", "=", "syncFlags(localMessage,", "remoteMessage);", "if", "(messageChanged)", "{", "boolean", "shouldBeNotifiedOf", "=", "false;", "if", "(localMessage.isSet(Flag.DELETED)", "||", "isMessageSuppressed(account,", "folder,", "localMessage))", "{", "for", "(MessagingListener", "l", ":", "getListeners())", "{", "l.synchronizeMailboxRemovedMessage(account,", "folder,", "localMessage);", "}", "}", "else", "{", "for", "(MessagingListener", "l", ":", "getListeners())", "{", "l.synchronizeMailboxAddOrUpdateMessage(account,", "folder,", "localMessage);", "}", "if", "(shouldNotifyForMessage(account,", "localFolder,", "localMessage))", "{", "shouldBeNotifiedOf", "=", "true;", "}", "}", "if", "(!shouldBeNotifiedOf)", "{", "<START>", "NotificationData", "data", "=", "getNotificationData(account,", "-1);", "<END>", "if", "(data", "!=", "null)", "{", "synchronized", "(data)", "{", "MessageReference", "ref", "=", "localMessage.makeMessageReference();", "if", "(data.removeMatchingMessage(mApplication,", "ref))", "{", "notifyAccountWithDataLocked(mApplication,", "account,", "null,", "data);", "}", "}", "}", "}", "}", "progress.incrementAndGet();", "for", "(MessagingListener", "l", ":", "getListeners())", "{", "l.synchronizeMailboxProgress(account,", "folder,", "progress.get(),", "todo);", "}", "}", "}", "}</code><technical_language>create", "a", "constant", "for", "-1?", "represents", "here</technical_language>" ]
[ "private", "void", "refreshLocalMessageFlags(final", "Account", "account,", "final", "Folder", "remoteFolder,", "final", "LocalFolder", "localFolder,", "ArrayList<Message>", "syncFlagMessages,", "final", "AtomicInteger", "progress,", "final", "int", "todo", ")", "throws", "MessagingException", "{", "final", "String", "folder", "=", "remoteFolder.getName();", "if", "(remoteFolder.supportsFetchingFlags())", "{", "if", "(K9.DEBUG)", "Log.d(K9.LOG_TAG,", "\"SYNC:", "About", "to", "sync", "flags", "for", "\"", "+", "syncFlagMessages.size()", "+", "\"", "remote", "messages", "for", "folder", "\"", "+", "folder);", "FetchProfile", "fp", "=", "new", "FetchProfile();", "fp.add(FetchProfile.Item.FLAGS);", "List<Message>", "undeletedMessages", "=", "new", "LinkedList<Message>();", "for", "(Message", "message", ":", "syncFlagMessages)", "{", "if", "(!message.isSet(Flag.DELETED))", "{", "undeletedMessages.add(message);", "}", "}", "remoteFolder.fetch(undeletedMessages.toArray(EMPTY_MESSAGE_ARRAY),", "fp,", "null);", "for", "(Message", "remoteMessage", ":", "syncFlagMessages)", "{", "Message", "localMessage", "=", "localFolder.getMessage(remoteMessage.getUid());", "boolean", "messageChanged", "=", "syncFlags(localMessage,", "remoteMessage);", "if", "(messageChanged)", "{", "boolean", "shouldBeNotifiedOf", "=", "false;", "if", "(localMessage.isSet(Flag.DELETED)", "||", "isMessageSuppressed(account,", "folder,", "localMessage))", "{", "for", "(MessagingListener", "l", ":", "getListeners())", "{", "l.synchronizeMailboxRemovedMessage(account,", "folder,", "localMessage);", "}", "}", "else", "{", "for", "(MessagingListener", "l", ":", "getListeners())", "{", "l.synchronizeMailboxAddOrUpdateMessage(account,", "folder,", "localMessage);", "}", "if", "(shouldNotifyForMessage(account,", "localFolder,", "localMessage))", "{", "shouldBeNotifiedOf", "=", "true;", "}", "}", "if", "(!shouldBeNotifiedOf)", "{", "NotificationData", "data", "=", "getNotificationData(account,", "null);", "if", "(data", "!=", "null)", "{", "synchronized", "(data)", "{", "MessageReference", "ref", "=", "localMessage.makeMessageReference();", "if", "(data.removeMatchingMessage(mApplication,", "ref))", "{", "notifyAccountWithDataLocked(mApplication,", "account,", "null,", "data);", "}", "}", "}", "}", "}", "progress.incrementAndGet();", "for", "(MessagingListener", "l", ":", "getListeners())", "{", "l.synchronizeMailboxProgress(account,", "folder,", "progress.get(),", "todo);", "}", "}", "}", "}" ]
[ "<code>public", "InputStream", "getObject(String", "bucketName,", "String", "objectName,", "long", "offset,", "Long", "length)", "throws", "InvalidBucketNameException,", "NoSuchAlgorithmException,", "InsufficientDataException,", "IOException,", "InvalidKeyException,", "NoResponseException,", "XmlPullParserException,", "ErrorResponseException,", "InternalException,", "<START>", "InvalidArgumentException", "{", "<END>", "if", "(offset", "<", "0)", "{", "throw", "new", "InvalidArgumentException(\"offset", "should", "be", "zero", "or", "greater\");", "}", "if", "(length", "!=", "null", "&&", "length", "<=", "0)", "{", "throw", "new", "InvalidArgumentException(\"length", "should", "be", "greater", "than", "zero\");", "}", "if", "((bucketName", "==", "null)", "||", "(bucketName.isEmpty()))", "{", "throw", "new", "InvalidArgumentException(\"bucket", "name", "cannot", "be", "empty\");", "}", "if", "((objectName", "==", "null)", "||", "(objectName.isEmpty()))", "{", "throw", "new", "InvalidArgumentException(\"object", "name", "cannot", "be", "empty\");", "}", "Map<String,String>", "headerMap", "=", "new", "HashMap<>();", "if", "(offset", ">", "0)", "{", "if", "(length", "!=", "null)", "{", "headerMap.put(\"Range\",", "\"bytes=\"", "+", "offset", "+", "\"-\"", "+", "(offset", "+", "length", "-", "1));", "}", "else", "{", "headerMap.put(\"Range\",", "\"bytes=\"", "+", "offset", "+", "\"-\");", "}", "}", "HttpResponse", "response", "=", "executeGet(bucketName,", "objectName,", "headerMap,", "null);", "return", "response.body().byteStream();", "}</code><technical_language>Do", "this", "validation", "first.", "order", "of", "method", "arguments</technical_language>" ]
[ "public", "InputStream", "getObject(String", "bucketName,", "String", "objectName,", "long", "offset,", "Long", "length)", "throws", "InvalidBucketNameException,", "NoSuchAlgorithmException,", "InsufficientDataException,", "IOException,", "InvalidKeyException,", "NoResponseException,", "XmlPullParserException,", "ErrorResponseException,", "InternalException,", "InvalidArgumentException", "{", "if", "((bucketName", "==", "null)", "||", "(bucketName.isEmpty()))", "{", "throw", "new", "InvalidArgumentException(\"bucket", "name", "cannot", "be", "empty\");", "}", "if", "((objectName", "==", "null)", "||", "(objectName.isEmpty()))", "{", "throw", "new", "InvalidArgumentException(\"object", "name", "cannot", "be", "empty\");", "}", "if", "(offset", "<", "0)", "{", "throw", "new", "InvalidArgumentException(\"offset", "should", "be", "zero", "or", "greater\");", "}", "if", "(length", "!=", "null", "&&", "length", "<=", "0)", "{", "throw", "new", "InvalidArgumentException(\"length", "should", "be", "greater", "than", "zero\");", "}", "Map<String,String>", "headerMap", "=", "new", "HashMap<>();", "if", "(offset", ">", "0)", "{", "if", "(length", "!=", "null)", "{", "headerMap.put(\"Range\",", "\"bytes=\"", "+", "offset", "+", "\"-\"", "+", "(offset", "+", "length", "-", "1));", "}", "else", "{", "headerMap.put(\"Range\",", "\"bytes=\"", "+", "offset", "+", "\"-\");", "}", "}", "HttpResponse", "response", "=", "executeGet(bucketName,", "objectName,", "headerMap,", "null);", "return", "response.body().byteStream();", "}" ]
[ "<code>public", "static", "FileUtils.FileCopyResult", "unzip(", "final", "ByteSource", "byteSource,", "final", "File", "outDir,", "boolean", "cacheLocally", ")", "throws", "IOException", "{", "<START>", "return", "unzip(byteSource,", "outDir,", "Predicates.<Throwable>alwaysTrue(),", "cacheLocally);", "<END>", "}</code><technical_language>I", "default", "retry", "Exceptions", "other", "kinds", "of", "Throwables</technical_language>" ]
[ "public", "static", "FileUtils.FileCopyResult", "unzip(", "final", "ByteSource", "byteSource,", "final", "File", "outDir,", "boolean", "cacheLocally", ")", "throws", "IOException", "{", "return", "unzip(byteSource,", "outDir,", "FileUtils.IS_EXCEPTION,", "cacheLocally);", "}" ]
[ "<code>public", "PrologEnvironment", "newPrologEnvironment()", "throws", "CompileException", "{", "<START>", "<END>", "PrologEnvironment", "env;", "if(urlLoader", "!=", "null)", "{", "env", "=", "envFactory.create(urlLoader);", "return", "env;", "}", "else", "{", "env", "=", "envFactory.create(getClass().getClassLoader());", "}", "String", "rules", "=", "getConfig().getPrologRules();", "if", "(rules", "!=", "null)", "{", "PushbackReader", "in", "=", "new", "PushbackReader(new", "StringReader(rules),", "Prolog.PUSHBACK_SIZE);", "JavaObjectTerm", "streamObject", "=", "new", "JavaObjectTerm(in);", "if", "(!env.execute(Prolog.BUILTIN,", "\"consult_stream\",", "SymbolTerm.intern(\"rules.pl\"),", "streamObject))", "{", "throw", "new", "CompileException(\"Cannot", "consult", "rules.pl", "\"", "+", "getProject().getName()", "+", "\"", "\"", "+", "getConfig().getRevision());", "}", "}", "return", "env;", "}</code><technical_language>Style-nit:", "Unnecessary", "blank", "line</technical_language>" ]
[ "public", "PrologEnvironment", "newPrologEnvironment()", "throws", "CompileException", "{", "PrologEnvironment", "env;", "if", "(cLoader", "!=", "null)", "{", "return", "envFactory.create(cLoader);", "}", "env", "=", "envFactory.create(getClass().getClassLoader());", "String", "rules", "=", "getConfig().getPrologRules();", "if", "(rules", "!=", "null)", "{", "PushbackReader", "in", "=", "new", "PushbackReader(new", "StringReader(rules),", "Prolog.PUSHBACK_SIZE);", "JavaObjectTerm", "streamObject", "=", "new", "JavaObjectTerm(in);", "if", "(!env.execute(Prolog.BUILTIN,", "\"consult_stream\",", "SymbolTerm.intern(\"rules.pl\"),", "streamObject))", "{", "throw", "new", "CompileException(\"Cannot", "consult", "rules.pl", "\"", "+", "getProject().getName()", "+", "\"", "\"", "+", "getConfig().getRevision());", "}", "}", "return", "env;", "}" ]
[ "<code>public", "void", "scheduleTask(TaskDefinition", "task)", "throws", "SchedulerException", "{", "<START>", "if", "(!Context.getSchedulerService().getTaskByName(task.getName()).getStarted())", "{", "<END>", "Context.getSchedulerService().scheduleTask(task);", "}", "}</code><technical_language>a", "look,", "i", "do", "need", "this", "call", "all.", "check", "of", "ensure", "a", "service", "is", "started", "schedule,", "etc,", "belong", "service", "layer", "API.", "role", "is", "simply", "call", "Context.getSchedulerService().scheduleTask(task)", "is", "all</technical_language>" ]
[ "public", "void", "scheduleTask(TaskDefinition", "task)", "throws", "SchedulerException", "{", "Context.getSchedulerService().scheduleTask(task);", "}" ]
[ "<code>protected", "ImmutableList<PubsubMessage>", "sendBatch(final", "List<PubsubMessage>", "batch)", "throws", "InterruptedException", "{", "final", "int", "batchSize", "=", "batch.size();", "final", "List<ApiFuture<String>>", "sendResults", "=", "batch.stream()", ".map(publisher::publish)", ".collect(Collectors.toCollection(()", "->", "new", "ArrayList<>(batchSize)));", "final", "ImmutableList.Builder<PubsubMessage>", "remaining", "=", "ImmutableList.builder();", "for", "(int", "i", "=", "0;", "i", "<", "batchSize;", "++i)", "{", "final", "ApiFuture<String>", "pendingResult", "=", "sendResults.get(i);", "try", "{", "final", "String", "messageId", "=", "pendingResult.get();", "if", "(logger.isDebugEnabled())", "{", "final", "PubsubMessage", "message", "=", "batch.get(i);", "logger.debug(\"Finished", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub:", "messageId", "=", "{}\",", "<START>", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID),", "<END>", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID),", "messageId);", "}", "}", "catch", "(final", "ExecutionException", "e)", "{", "final", "PubsubMessage", "message", "=", "batch.get(i);", "final", "Throwable", "cause", "=", "e.getCause();", "if", "(cause", "instanceof", "ApiException)", "{", "final", "ApiException", "apiException", "=", "(ApiException)", "cause;", "if", "(apiException.isRetryable())", "{", "logger.debug(\"Transient", "error", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub;", "retrying.\",", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID),", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID),", "cause);", "remaining.add(message);", "}", "else", "{", "logger.warn(\"Permanent", "error", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub;", "abandoning.\",", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID),", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID),", "cause);", "}", "}", "else", "{", "logger.error(\"Unknown", "error", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub;", "abandoning.\",", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_PARTYID),", "message.getAttributesOrThrow(MESSAGE_ATTRIBUTE_EVENTID),", "cause);", "}", "}", "}", "return", "remaining.build();", "}</code><technical_language>debug", "logging", "change", "applicationflow.", "getAttributesOrThrow", "would.", "getAttributesOrDefault", "is", "I</technical_language>" ]
[ "protected", "ImmutableList<PubsubMessage>", "sendBatch(final", "List<PubsubMessage>", "batch)", "throws", "InterruptedException", "{", "final", "int", "batchSize", "=", "batch.size();", "final", "List<ApiFuture<String>>", "sendResults", "=", "batch.stream()", ".map(publisher::publish)", ".collect(Collectors.toCollection(()", "->", "new", "ArrayList<>(batchSize)));", "final", "ImmutableList.Builder<PubsubMessage>", "remaining", "=", "ImmutableList.builder();", "for", "(int", "i", "=", "0;", "i", "<", "batchSize;", "++i)", "{", "final", "ApiFuture<String>", "pendingResult", "=", "sendResults.get(i);", "try", "{", "final", "String", "messageId", "=", "pendingResult.get();", "if", "(logger.isDebugEnabled())", "{", "final", "PubsubMessage", "message", "=", "batch.get(i);", "logger.debug(\"Finished", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub:", "messageId", "=", "{}\",", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID,", "\"N/A\"),", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID,", "\"N/A\"),", "messageId);", "}", "}", "catch", "(final", "ExecutionException", "e)", "{", "final", "PubsubMessage", "message", "=", "batch.get(i);", "final", "Throwable", "cause", "=", "e.getCause();", "if", "(cause", "instanceof", "ApiException)", "{", "final", "ApiException", "apiException", "=", "(ApiException)", "cause;", "if", "(apiException.isRetryable())", "{", "logger.debug(\"Transient", "error", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub;", "retrying.\",", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID,", "\"N/A\"),", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID,", "\"N/A\"),", "cause);", "remaining.add(message);", "}", "else", "{", "logger.warn(\"Permanent", "error", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub;", "abandoning.\",", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID,", "\"N/A\"),", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID,", "\"N/A\"),", "cause);", "}", "}", "else", "{", "logger.error(\"Unknown", "error", "sending", "event", "(partyId={},", "eventId={})", "to", "Pub/Sub;", "abandoning.\",", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_PARTYID,", "\"N/A\"),", "message.getAttributesOrDefault(MESSAGE_ATTRIBUTE_EVENTID,", "\"N/A\"),", "cause);", "}", "}", "}", "return", "remaining.build();", "}" ]
[ "<code>public", "String", "validate(String", "parameterValue,", "ModelValidatorContext", "context)", "throws", "ValidationException", "{", "try", "{", "if", "(!isValidJSON(parameterValue))", "{", "<START>", "throw", "new", "ValidationException(\"Expected", "value", "should", "match", "JSON", "format,", "received", "\"", "+", "parameterValue);", "<END>", "}", "}", "catch", "(ValidationException", "er)", "{", "throw", "new", "ValidationException(\"Validator", "error", "from", "JsonParser:", "Expected", "value", "should", "match", "JSON", "format,", "received", "\"", "+", "parameterValue);", "}", "return", "parameterValue;", "}</code><technical_language>I", "this", "part", "improved.", "isValidJSON", "returns", "a", "boolean", "throws", "a", "ValidationException.", "decide", "a", "single", "strategy,", "return", "true", "false", "return", "void", "throw", "exception.", "I", "prefer", "latter,", "exception", "contains", "more", "meaningful", "error", "messages", "true/false.", "In", "case", "method", "renamed", "checkValidJson</technical_language>" ]
[ "public", "String", "validate(String", "parameterValue,", "ModelValidatorContext", "context)", "throws", "ValidationException", "{", "try", "{", "final", "JsonParser", "parser", "=", "new", "ObjectMapper().getJsonFactory().createJsonParser(parameterValue);", "while", "(parser.nextToken()", "!=", "null)", "{", "}", "}", "catch", "(Exception", "jpe)", "{", "throw", "new", "ValidationException(\"Invalid", "JSON:", "\"", "+", "jpe.getMessage(),", "jpe);", "}", "return", "parameterValue;", "}" ]
[ "<code>public", "void", "getVersion()", "throws", "Exception", "{", "<START>", "String", "version", "=", "gApi.config().server().getVersion();", "<END>", "Truth.assertThat(version).is(Version.getVersion());", "}</code><technical_language>inlined", "in", "assertThat", "statement", "below</technical_language>" ]
[ "public", "void", "getVersion()", "throws", "Exception", "{", "assertThat(gApi.config().server().getVersion())", ".isEqualTo(Version.getVersion());", "}" ]
[ "<code>public", "HttpRequest", "filter(HttpRequest", "request)", "throws", "HttpException", "{", "Credentials", "currentCreds", "=", "checkNotNull(creds.get(),", "\"credential", "supplier", "returned", "null\");", "Signer", "signer", "=", "Signer.getSigner();", "String", "signature;", "Multimap<String,", "String>", "decodedParams", "=", "queryParser().apply(request.getEndpoint().getRawQuery());", "SimpleDateFormat", "df", "=", "new", "SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss'Z'\");", "df.setTimeZone(new", "SimpleTimeZone(0,", "\"GMT\"));", "String", "timestamp", "=", "df.format(new", "Date());", "String", "signatureNonce", "=", "UUID.randomUUID().toString();", "decodedParams.put(\"AccessKeyId\",", "currentCreds.identity);", "decodedParams.put(\"Timestamp\",", "timestamp);", "decodedParams.put(\"SignatureNonce\",", "signatureNonce);", "String", "prefix;", "try", "{", "prefix", "=", "request.getMethod()", "+", "SEPARATOR", "+", "AcsURLEncoder.percentEncode(\"/\")", "+", "SEPARATOR;", "}", "catch", "(UnsupportedEncodingException", "e)", "{", "throw", "Throwables.propagate(e);", "}", "String", "stringToSign", "=", "prefix;", "ImmutableSortedSet.Builder<String>", "builder", "=", "ImmutableSortedSet.naturalOrder();", "for", "(Map.Entry<String,", "String>", "entry", ":", "decodedParams.entries())", "builder.add(Strings2.urlEncode(entry.getKey())", "+", "\"=\"", "+", "Strings2.urlEncode(entry.getValue()));", "<START>", "stringToSign", "+=", "Strings2.urlEncode(Joiner.on(\"&\").join(builder.build()));", "<END>", "signature", "=", "signer.signString(stringToSign,", "currentCreds.credential", "+", "\"&\");", "decodedParams.put(\"Signature\",", "signature);", "request", "=", "request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).query(decodedParams).build()).build();", "return", "request;", "}</code><technical_language>If", "jclouds", "Uris", "UriBuilder", "classes", "I", "worry", "manually", "encoding", "parameters</technical_language>" ]
[ "public", "HttpRequest", "filter(HttpRequest", "request)", "throws", "HttpException", "{", "Credentials", "currentCreds", "=", "checkNotNull(creds.get(),", "\"credential", "supplier", "returned", "null\");", "Multimap<String,", "String>", "decodedParams", "=", "queryParser().apply(request.getEndpoint().getQuery());", "SimpleDateFormat", "df", "=", "new", "SimpleDateFormat(ECS_DATE_FORMAT);", "df.setTimeZone(new", "SimpleTimeZone(0,", "\"GMT\"));", "String", "timestamp", "=", "df.format(new", "Date());", "String", "signatureNonce", "=", "UUID.randomUUID().toString();", "decodedParams.put(\"AccessKeyId\",", "currentCreds.identity);", "decodedParams.put(\"Timestamp\",", "timestamp);", "decodedParams.put(\"SignatureNonce\",", "signatureNonce);", "String", "stringToSign", "=", "createStringToSign(request.getMethod(),", "decodedParams);", "String", "signature", "=", "sign(stringToSign,", "creds.get().credential);", "decodedParams.put(\"Signature\",", "signature);", "request", "=", "request.toBuilder().endpoint(uriBuilder(request.getEndpoint()).query(decodedParams).build()).build();", "return", "request;", "}" ]
[ "<code>public", "void", "beforeDocumentChange(DocumentEvent", "event)", "{", "Document", "document", "=", "event.getDocument();", "SPath", "path", "=", "editorManager.getEditorPool().getFile(document);", "if", "(path", "==", "null)", "{", "VirtualFile", "virtualFile", "=", "FileDocumentManager.getInstance()", ".getFile(document);", "if", "(virtualFile", "==", "null)", "{", "<START>", "LOG.debug(\"Ignoring", "event", "for", "document", "\"", "+", "document", "<END>", "+", "\"", "-", "document", "is", "not", "known", "to", "the", "editor", "pool", "and", "a", "\"", "+", "\"VirtualFile", "for", "the", "document", "could", "not", "be", "found\");", "return;", "}", "path", "=", "virtualFileConverter.convertToPath(virtualFile);", "if", "(path", "==", "null)", "{", "LOG.debug(\"Ignoring", "event", "for", "document", "\"", "+", "document", "+", "\"", "-", "document", "is", "not", "known", "to", "the", "editor", "pool", "and", "an", "\"", "+", "\"SPath", "for", "the", "document", "could", "not", "be", "found\");", "return;", "}", "else", "if", "(!editorManager.getSession()", ".isShared(path.getResource()))", "{", "LOG.debug(\"Ignoring", "Event", "for", "document", "\"", "+", "document", "+", "\"", "-", "document", "is", "not", "shared\");", "return;", "}", "}", "String", "newText", "=", "event.getNewFragment().toString();", "String", "replacedText", "=", "event.getOldFragment().toString();", "editorManager", ".generateTextEdit(event.getOffset(),", "newText,", "replacedText,", "path);", "}</code><technical_language>tracking", "files", "in", "IDE", "?", "If", "this", "flood", "log", "file", "a", "bit", "depending", "sharing", "setup,", "e.g", "do", "a", "partial", "sharing", "a", "files</technical_language>" ]
[ "public", "void", "beforeDocumentChange(DocumentEvent", "event)", "{", "Document", "document", "=", "event.getDocument();", "SPath", "path", "=", "editorManager.getEditorPool().getFile(document);", "if", "(path", "==", "null)", "{", "VirtualFile", "virtualFile", "=", "FileDocumentManager.getInstance()", ".getFile(document);", "if", "(virtualFile", "==", "null)", "{", "LOG.trace(\"Ignoring", "event", "for", "document", "\"", "+", "document", "+", "\"", "-", "document", "is", "not", "known", "to", "the", "editor", "pool", "and", "a", "\"", "+", "\"VirtualFile", "for", "the", "document", "could", "not", "be", "found\");", "return;", "}", "path", "=", "virtualFileConverter.convertToPath(virtualFile);", "if", "(path", "==", "null)", "{", "LOG.trace(\"Ignoring", "Event", "for", "document", "\"", "+", "document", "+", "\"", "-", "document", "is", "not", "shared\");", "return;", "}", "}", "String", "newText", "=", "event.getNewFragment().toString();", "String", "replacedText", "=", "event.getOldFragment().toString();", "editorManager", ".generateTextEdit(event.getOffset(),", "newText,", "replacedText,", "path);", "}" ]
[ "<code>private", "void", "initialize()", "{", "<START>", "Assert.isNotNull(scope,", "\"Task", "scope", "should", "not", "be", "null.\");", "END>", "events.addAll(manager.getEvents(scope));", "try", "{", "ReviewTaskProvider", "reviewTaskProvider", "=", "new", "ReviewTaskProvider();", "reviewTaskProvider.open(manager);", "reviewTaskProvider.query(scope,", "null);", "}", "catch", "(CoreException", "e)", "{", "System.out.println(e);", "}", "events.addAll(manager.getEvents(scope));", "}</code><technical_language>constructor", "asserts</technical_language>" ]
[ "private", "void", "initialize()", "{", "events.addAll(manager.getEvents(scope));", "}" ]
[ "<code>public", "void", "registerInterposedSynchronization(Synchronization", "sync)", "throws", "IllegalStateException", "{", "try", "{", "Transaction", "tx", "=", "transactionManager.getTransaction();", "JCAOrderedLastSynchronizationList", "jcaOrderedLastSynchronization", "=", "interposedSyncs.get(tx);", "<START>", "if", "(jcaOrderedLastSynchronization", "==", "null)", "{", "<END>", "jcaOrderedLastSynchronization", "=", "new", "JCAOrderedLastSynchronizationList(tx,", "interposedSyncs);", "delegate.registerInterposedSynchronization(jcaOrderedLastSynchronization);", "}", "jcaOrderedLastSynchronization.add(sync);", "}", "catch", "(SystemException", "e)", "{", "throw", "new", "IllegalStateException(e);", "}", "}</code><technical_language>putIfAbsent", "semantics", "is</technical_language>" ]
[ "public", "void", "registerInterposedSynchronization(Synchronization", "sync)", "throws", "IllegalStateException", "{", "try", "{", "Transaction", "tx", "=", "transactionManager.getTransaction();", "JCAOrderedLastSynchronizationList", "jcaOrderedLastSynchronization", "=", "interposedSyncs.get(tx);", "if", "(jcaOrderedLastSynchronization", "==", "null)", "{", "JCAOrderedLastSynchronizationList", "toPut", "=", "new", "JCAOrderedLastSynchronizationList(tx,", "interposedSyncs);", "jcaOrderedLastSynchronization", "=", "interposedSyncs.putIfAbsent(tx,", "toPut);", "if", "(jcaOrderedLastSynchronization", "==", "null)", "{", "jcaOrderedLastSynchronization", "=", "toPut;", "delegate.registerInterposedSynchronization(jcaOrderedLastSynchronization);", "}", "}", "jcaOrderedLastSynchronization.addInterposedSynchronization(sync);", "}", "catch", "(SystemException", "e)", "{", "throw", "new", "IllegalStateException(e);", "}", "}" ]
[ "<code>void", "setUp()", "{", "mockApplicationContext", "=", "mock(ApplicationContext.class);", "mockEventStore", "=", "mock(EventStore.class);", "mockRepositoryProvider", "=", "mock(RepositoryProvider.class);", "executor", "=", "spy(new", "MockExecutor());", "testSubject", "=", "new", "SpringAggregateSnapshotterFactoryBean();", "testSubject.setApplicationContext(mockApplicationContext);", "testSubject.setExecutor(executor);", "when(mockApplicationContext.getBeansOfType(AggregateFactory.class)).thenReturn(", "Collections.singletonMap(\"myFactory\",", "new", "AbstractAggregateFactory<StubAggregate>(StubAggregate.class)", "{", "@Override", "public", "StubAggregate", "doCreateAggregate(String", "aggregateIdentifier,", "DomainEventMessage", "firstEvent)", "{", "return", "new", "StubAggregate(aggregateIdentifier);", "}", "}));", "testSubject.setEventStore(mockEventStore);", "testSubject.setRepositoryProvider(mockRepositoryProvider);", "mockTransactionManager", "=", "mock(PlatformTransactionManager.class);", "aggregateIdentifier", "=", "UUID.randomUUID().toString();", "<START>", "String", "type", "=", "\"StubAggregate\";", "<END>", "DomainEventMessage", "event1", "=", "new", "GenericDomainEventMessage<>(type,", "aggregateIdentifier,", "0L,", "\"Mock", "contents\",", "MetaData.emptyInstance());", "DomainEventMessage", "event2", "=", "new", "GenericDomainEventMessage<>(type,", "aggregateIdentifier,", "1L,", "\"Mock", "contents\",", "MetaData.emptyInstance());", "when(mockEventStore.readEvents(aggregateIdentifier)).thenReturn(DomainEventStream.of(event1,", "event2));", "}</code><technical_language>nice", "for", "test", "pass", "modifications,", "show", "compatibility</technical_language>" ]
[ "void", "setUp()", "{", "mockApplicationContext", "=", "mock(ApplicationContext.class);", "mockEventStore", "=", "mock(EventStore.class);", "mockRepositoryProvider", "=", "mock(RepositoryProvider.class);", "executor", "=", "spy(new", "MockExecutor());", "testSubject", "=", "new", "SpringAggregateSnapshotterFactoryBean();", "testSubject.setApplicationContext(mockApplicationContext);", "testSubject.setExecutor(executor);", "when(mockApplicationContext.getBeansOfType(AggregateFactory.class)).thenReturn(", "Collections.singletonMap(\"myFactory\",", "new", "AbstractAggregateFactory<StubAggregate>(StubAggregate.class)", "{", "@Override", "public", "StubAggregate", "doCreateAggregate(String", "aggregateIdentifier,", "DomainEventMessage", "firstEvent)", "{", "return", "new", "StubAggregate(aggregateIdentifier);", "}", "}));", "testSubject.setEventStore(mockEventStore);", "testSubject.setRepositoryProvider(mockRepositoryProvider);", "mockTransactionManager", "=", "mock(PlatformTransactionManager.class);", "aggregateIdentifier", "=", "UUID.randomUUID().toString();", "String", "type", "=", "\"testAggregate\";", "DomainEventMessage", "event1", "=", "new", "GenericDomainEventMessage<>(type,", "aggregateIdentifier,", "0L,", "\"Mock", "contents\",", "MetaData.emptyInstance());", "DomainEventMessage", "event2", "=", "new", "GenericDomainEventMessage<>(type,", "aggregateIdentifier,", "1L,", "\"Mock", "contents\",", "MetaData.emptyInstance());", "when(mockEventStore.readEvents(aggregateIdentifier)).thenReturn(DomainEventStream.of(event1,", "event2));", "}" ]
[ "<code>public", "void", "run()", "{", "try", "(OpenShiftClient", "client", "=", "clouldClientHelper.get())", "{", "logger.info(\"Watching", "ConfigMap", "in", "namespace", "{}\",", "client.getNamespace());", "try", "(Watch", "watchable", "=", "client.configMaps().watch(new", "Watcher<ConfigMap>()", "{", "@Override", "public", "void", "eventReceived(Action", "action,", "ConfigMap", "kieServerState)", "{", "logger.info(\"Event", "-", "Action:", "{},", "{}", "on", "ConfigMap", "\",", "action,", "kieServerState.getMetadata().getName());", "DeploymentConfig", "dc", "=", "client.deploymentConfigs().withName(kieServerId).get();", "if", "(kieServerId.equals(kieServerState.getMetadata().getName())", "&&", "action.equals(Action.MODIFIED)", "&&", "\"True\".equals(dc.getStatus().getConditions().get(0).getStatus())", "&&", "triggerRollout(client,", "kieServerId))", "{", "ObjectMeta", "md", "=", "dc.getSpec().getTemplate().getMetadata();", "Map<String,", "String>", "ann", "=", "md.getAnnotations()", "==", "null", "?", "new", "HashMap<>()", ":", "md.getAnnotations();", "md.setAnnotations(ann);", "ann.put(ROLLOUT_TRIGGER_TIMESTAMP,", "ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT));", "client.deploymentConfigs().createOrReplace(dc);", "logger.info(\"Update", "DeploymentConfig:", "{}\",", "md.getName());", "}", "else", "{", "<START>", "logger.info(\"Event", "-", "Ignored\");", "<END>", "}", "}", "@Override", "public", "void", "onClose(KubernetesClientException", "cause)", "{", "logger.info(\"Watcher", "closed.\");", "if", "(cause", "!=", "null)", "{", "logger.info(cause.getMessage());", "}", "}", "}))", "{", "logger.info(\"Watcher", "created.\");", "Runtime.getRuntime().addShutdownHook(new", "Thread(()", "->", "{", "synchronized", "(this)", "{", "isWatchRunning", "=", "false;", "notifyAll();", "logger.info(\"ShutdownHook", "sent", "notifyAll.\");", "}", "}));", "synchronized", "(this)", "{", "while", "(isWatchRunning", "&&", "!Thread.currentThread().isInterrupted())", "{", "logger.info(\"WatchRunner", "thread", "starts.\");", "try", "{", "wait();", "}", "catch", "(InterruptedException", "e)", "{", "Thread.currentThread().interrupt();", "logger.error(\"WatchRunner", "thread", "being", "interrupted\",", "e);", "}", "logger.info(\"WatchRunner", "thread", "being", "notified.\");", "}", "logger.info(\"WatchRunner", "thread", "exits.\");", "}", "}", "}", "catch", "(KubernetesClientException", "e)", "{", "logger.error(\"Failed\",", "e);", "}", "}</code><technical_language>this", "logged", "change", "level", "debug", "log", "event", "is", "ignored</technical_language>" ]
[ "public", "void", "run()", "{", "try", "(OpenShiftClient", "client", "=", "clouldClientHelper.get())", "{", "logger.info(\"Watching", "ConfigMap", "in", "namespace:", "[{}]\",", "client.getNamespace());", "try", "(Watch", "watchable", "=", "client.configMaps().watch(new", "Watcher<ConfigMap>()", "{", "@Override", "public", "void", "eventReceived(Action", "action,", "ConfigMap", "kieServerState)", "{", "logger.debug(\"Event", "-", "Action:", "{},", "{}", "on", "ConfigMap", "\",", "action,", "kieServerState.getMetadata().getName());", "DeploymentConfig", "dc", "=", "client.deploymentConfigs().withName(kieServerId).get();", "if", "(kieServerId.equals(kieServerState.getMetadata().getName())", "&&", "action.equals(Action.MODIFIED)", "&&", "isRolloutRequired(client,", "kieServerId,", "isDCStable(dc)))", "{", "ObjectMeta", "md", "=", "dc.getSpec().getTemplate().getMetadata();", "Map<String,", "String>", "ann", "=", "md.getAnnotations()", "==", "null", "?", "new", "HashMap<>()", ":", "md.getAnnotations();", "md.setAnnotations(ann);", "ann.put(ROLLOUT_TRIGGER_TIMESTAMP,", "ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT));", "client.deploymentConfigs().createOrReplace(dc);", "logger.info(\"Updated", "DeploymentConfig:", "{}\",", "md.getName());", "}", "else", "{", "logger.debug(\"Event", "-", "Ignored\");", "}", "}", "@Override", "public", "void", "onClose(KubernetesClientException", "cause)", "{", "logger.info(\"Watcher", "closed.\");", "if", "(cause", "!=", "null)", "{", "logger.info(cause.getMessage());", "}", "}", "}))", "{", "logger.info(\"Watcher", "created\");", "Runtime.getRuntime().addShutdownHook(new", "Thread(()", "->", "{", "synchronized", "(this)", "{", "isWatchRunning", "=", "false;", "notifyAll();", "logger.info(\"ShutdownHook", "sent", "notifyAll\");", "}", "}));", "synchronized", "(this)", "{", "while", "(isWatchRunning", "&&", "!Thread.currentThread().isInterrupted())", "{", "logger.info(\"WatchRunner", "thread", "run\");", "try", "{", "wait();", "}", "catch", "(InterruptedException", "e)", "{", "Thread.currentThread().interrupt();", "logger.error(\"WatchRunner", "thread", "being", "interrupted\",", "e);", "}", "logger.info(\"WatchRunner", "thread", "being", "notified\");", "}", "logger.info(\"WatchRunner", "thread", "exits\");", "}", "}", "}", "catch", "(KubernetesClientException", "kce)", "{", "logger.error(\"WatchRunner", "thread", "failed\",", "kce);", "}", "}" ]
[ "<code>private", "static", "Integer", "getPlatFormOffset()", "{", "String", "currentOs", "=", "System.getProperty(\"os.name\").toLowerCase(Locale.ROOT);", "String", "currentJdk", "=", "System.getProperty(\"java.version\").toLowerCase(Locale.ROOT);", "for", "(int", "i", "=", "0;", "i", "<", "PLATFORM_LIST.size();", "i++)", "{", "if", "(currentOs.toLowerCase(Locale.ROOT).contains(PLATFORM_LIST.get(i).split(\",\")[0].toLowerCase(Locale.ROOT))", "&&", "currentJdk.toLowerCase(Locale.ROOT).contains(", "PLATFORM_LIST.get(i).split(\",\")[1].toLowerCase(Locale.ROOT)))", "{", "return", "i;", "}", "}", "<START>", "return", "null;", "<END>", "}</code><technical_language>Throw", "exception", "log", "error", "including", "currentOs", "currentJdk.", "Returning", "null", "a", "NPE", "upstream", "OS,", "JDK", "name", "caused", "it</technical_language>" ]
[ "private", "static", "Integer", "getPlatFormOffset()", "{", "ClientLogger", "logger", "=", "new", "ClientLogger(TestBase.class);", "String", "currentOs", "=", "System.getProperty(\"os.name\").toLowerCase(Locale.ROOT);", "logger.info(\"It", "is", "currently", "running", "on", "os:", "\"", "+", "currentOs);", "String", "currentJdk", "=", "System.getProperty(\"java.version\").toLowerCase(Locale.ROOT);", "logger.info(\"It", "is", "using", "jdk:", "\"", "+", "currentJdk);", "for", "(int", "i", "=", "0;", "i", "<", "PLATFORM_LIST.size();", "i++)", "{", "if", "(isCurrentPlatformIncluded(currentOs,", "currentJdk,", "i))", "{", "return", "i;", "}", "}", "throw", "new", "RuntimeException(String.format(\"Not", "running", "on", "the", "expected", "platform.", "os:", "%s,", "jdk:", "%s\",", "currentOs,", "currentJdk));", "}" ]
[ "<code>public", "void", "subscribeUnsubscribe()", "throws", "Exception", "{", "final", "Postman", "postman", "=", "Mockito.mock(Postman.class);", "final", "DyBase", "base", "=", "new", "DyBase();", "final", "Alias", "alias", "=", "new", "EmAlias(this.randomAlias(base),", "postman);", "final", "Bout", "bout", "=", "alias.inbox().bout(alias.inbox().start());", "final", "Alias", "friend", "=", "this.randomAlias(base);", "bout.friends().invite(friend.name());", "final", "ArgumentCaptor<Envelope>", "captor", "=", "ArgumentCaptor.forClass(Envelope.class);", "friend.inbox().bout(bout.number()).subscribe(false);", "bout.messages().post(DON_T_SEND_IT);", "friend.inbox().bout(bout.number()).subscribe(true);", "bout.messages().post(SEND_IT);", "bout.messages().post(SEND_IT);", "friend.inbox().bout(bout.number()).subscribe(false);", "bout.messages().post(DON_T_SEND_IT);", "Mockito.verify(postman,", "Mockito.times(2)).send(captor.capture());", "final", "List<Envelope>", "messages", "=", "captor.getAllValues();", "for", "(final", "Envelope", "envelope", ":", "messages)", "{", "final", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream();", "MimeMultipart.class.cast(envelope.unwrap().getContent())", ".writeTo(baos);", "MatcherAssert.assertThat(", "baos.toString(),", "Matchers.containsString(", "<START>", "SEND_IT", "<END>", ")", ");", "}", "}</code><technical_language>@pecko", "assert", "other", "string</technical_language>" ]
[ "public", "void", "subscribeUnsubscribe()", "throws", "Exception", "{", "final", "Postman", "postman", "=", "Mockito.mock(Postman.class);", "final", "DyBase", "base", "=", "new", "DyBase();", "final", "Alias", "alias", "=", "new", "EmAlias(this.getAlias(base,", "26,", "6),", "postman);", "final", "Bout", "bout", "=", "alias.inbox().bout(alias.inbox().start());", "final", "Alias", "friend", "=", "this.getAlias(base,", "20,", "1);", "bout.friends().invite(friend.name());", "final", "ArgumentCaptor<Envelope>", "captor", "=", "ArgumentCaptor.forClass(Envelope.class);", "friend.inbox().bout(bout.number()).subscribe(false);", "final", "String", "dontsend", "=", "\"don't", "send", "it\";", "bout.messages().post(dontsend);", "friend.inbox().bout(bout.number()).subscribe(true);", "final", "String", "send", "=", "\"send", "it\";", "bout.messages().post(send);", "bout.messages().post(send);", "friend.inbox().bout(bout.number()).subscribe(false);", "bout.messages().post(dontsend);", "Mockito.verify(postman,", "Mockito.times(2)).send(captor.capture());", "final", "List<Envelope>", "messages", "=", "captor.getAllValues();", "for", "(final", "Envelope", "envelope", ":", "messages)", "{", "final", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream();", "MimeMultipart.class.cast(envelope.unwrap().getContent())", ".writeTo(baos);", "MatcherAssert.assertThat(", "baos.toString(),", "Matchers.not(Matchers.containsString(dontsend))", ");", "MatcherAssert.assertThat(", "baos.toString(),", "Matchers.containsString(send)", ");", "}", "}" ]
[ "<code>private", "void", "testCopyQuestion()", "throws", "Exception", "{", "______TS(\"Success", "case:", "copy", "questions", "successfully\");", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyTableToLoad();", "assertFalse(\"Unable", "to", "submit", "when", "there", "are", "no", "questions", "selected\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "feedbackEditPage.verifyHtmlPart(By.id(\"copyModal\"),", "\"/instructorFeedbackCopyQuestionModal.html\");", "feedbackEditPage.clickCopyTableAtRow(0);", "assertTrue(\"Can", "click", "after", "selecting\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "feedbackEditPage.clickCopySubmitButton();", "feedbackEditPage.verifyHtmlMainContent(\"/instructorFeedbackCopyQuestionSuccess.html\");", "______TS(\"Success", "case:", "copy", "multiple", "questions", "successfully\");", "int", "numQuestionEditForms", "=", "feedbackEditPage.getNumberOfQuestionEditForms();", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyTableToLoad();", "feedbackEditPage.clickCopyTableAtRow(0);", "feedbackEditPage.clickCopyTableAtRow(1);", "feedbackEditPage.clickCopySubmitButton();", "assertEquals(numQuestionEditForms", "+", "2,", "feedbackEditPage.getNumberOfQuestionEditForms());", "______TS(\"No", "copiable", "questions\");", "feedbackEditPage", "=", "getFeedbackEditPageOfCourseWithoutQuestions();", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyErrorMessageToLoad();", "assertEquals(\"There", "are", "no", "questions", "to", "be", "copied.\",", "feedbackEditPage.getCopyErrorMessageText());", "assertFalse(\"Should", "not", "be", "able", "to", "submit", "if", "there", "are", "no", "questions\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "______TS(\"Fails", "gracefully", "with", "an", "error", "message\");", "feedbackEditPage", "=", "getFeedbackEditPage();", "<START>", "feedbackEditPage.changeActionLinkOnCopyButton(\"invalid", "URL\");", "<END>", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyErrorMessageToLoad();", "assertEquals(\"Error", "retrieving", "questions.", "Please", "close", "the", "dialog", "window", "and", "try", "again.\",", "feedbackEditPage.getCopyErrorMessageText());", "assertFalse(\"Should", "not", "be", "able", "to", "submit", "if", "loading", "failed\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "String", "questionId", "=", "getFeedbackQuestionWithRetry(courseId,", "feedbackSessionName,", "4).getId();", "BackDoor.deleteFeedbackQuestion(questionId);", "questionId", "=", "getFeedbackQuestionWithRetry(courseId,", "feedbackSessionName,", "3).getId();", "BackDoor.deleteFeedbackQuestion(questionId);", "}</code><technical_language>related", "gender", "type</technical_language>" ]
[ "private", "void", "testCopyQuestion()", "throws", "Exception", "{", "______TS(\"Success", "case:", "copy", "questions", "successfully\");", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyTableToLoad();", "assertFalse(\"Unable", "to", "submit", "when", "there", "are", "no", "questions", "selected\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "feedbackEditPage.verifyHtmlPart(By.id(\"copyModal\"),", "\"/instructorFeedbackCopyQuestionModal.html\");", "feedbackEditPage.clickCopyTableAtRow(0);", "assertTrue(\"Can", "click", "after", "selecting\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "feedbackEditPage.clickCopySubmitButton();", "feedbackEditPage.verifyHtmlMainContent(\"/instructorFeedbackCopyQuestionSuccess.html\");", "______TS(\"Success", "case:", "copy", "multiple", "questions", "successfully\");", "int", "numQuestionEditForms", "=", "feedbackEditPage.getNumberOfQuestionEditForms();", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyTableToLoad();", "feedbackEditPage.clickCopyTableAtRow(0);", "feedbackEditPage.clickCopyTableAtRow(1);", "feedbackEditPage.clickCopySubmitButton();", "assertEquals(numQuestionEditForms", "+", "2,", "feedbackEditPage.getNumberOfQuestionEditForms());", "______TS(\"No", "copiable", "questions\");", "feedbackEditPage", "=", "getFeedbackEditPageOfCourseWithoutQuestions();", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyErrorMessageToLoad();", "assertEquals(\"There", "are", "no", "questions", "to", "be", "copied.\",", "feedbackEditPage.getCopyErrorMessageText());", "assertFalse(\"Should", "not", "be", "able", "to", "submit", "if", "there", "are", "no", "questions\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "______TS(\"Fails", "gracefully", "with", "an", "error", "message\");", "feedbackEditPage", "=", "getFeedbackEditPage();", "feedbackEditPage.changeActionLinkOnCopyButton(\"INVALID", "URL\");", "feedbackEditPage.clickCopyButton();", "feedbackEditPage.waitForCopyErrorMessageToLoad();", "assertEquals(\"Error", "retrieving", "questions.", "Please", "close", "the", "dialog", "window", "and", "try", "again.\",", "feedbackEditPage.getCopyErrorMessageText());", "assertFalse(\"Should", "not", "be", "able", "to", "submit", "if", "loading", "failed\",", "feedbackEditPage.isCopySubmitButtonEnabled());", "String", "questionId", "=", "getFeedbackQuestionWithRetry(courseId,", "feedbackSessionName,", "4).getId();", "BackDoor.deleteFeedbackQuestion(questionId);", "questionId", "=", "getFeedbackQuestionWithRetry(courseId,", "feedbackSessionName,", "3).getId();", "BackDoor.deleteFeedbackQuestion(questionId);", "}" ]
[ "<code>public", "Ban.Builder", "profile(org.spongepowered.api.profile.GameProfile", "profile)", "{", "checkNotNull(profile,", "\"Profile", "cannot", "be", "null!\");", "<START>", "checkState(banType", "==", "BanTypes.PROFILE,", "\"Cannot", "set", "a", "GameProfile", "if", "the", "BanType", "is", "not", "BanType.USER_BAN!\");", "<END>", "this.profile", "=", "profile;", "return", "this;", "}</code><technical_language>Message", "needs", "updating</technical_language>" ]
[ "public", "Ban.Builder", "profile(org.spongepowered.api.profile.GameProfile", "profile)", "{", "checkNotNull(profile,", "\"Profile", "cannot", "be", "null!\");", "checkState(banType", "==", "BanTypes.PROFILE,", "\"Cannot", "set", "a", "GameProfile", "if", "the", "BanType", "is", "not", "BanTypes.PROFILE!\");", "this.profile", "=", "profile;", "return", "this;", "}" ]
[ "<code>public", "void", "removeListener()", "{", "View", "view", "=", "getView();", "if", "(view", "!=", "null)", "{", "getDiagramEventBroker().removeNotificationListener(view,", "this);", "if", "(hostSemanticElement", "!=", "null)", "{", "for", "(EObject", "stereotypeApplication", ":", "hostSemanticElement.getStereotypeApplications())", "{", "getDiagramEventBroker().removeNotificationListener(stereotypeApplication,", "this);", "}", "getDiagramEventBroker().removeNotificationListener(hostSemanticElement,", "this);", "hostSemanticElement", "=", "null;", "}", "}", "if", "(!stereotypeList.isEmpty())", "{", "for", "(Stereotype", "stereotype", ":", "stereotypeList)", "{", "View", "label", "=", "helper.getStereotypeLabel(hostView,", "stereotype);", "if", "(null", "!=", "label)", "{", "getDiagramEventBroker().removeNotificationListener(label,", "this);", "}", "BasicCompartment", "compartment", "=", "helper.getStereotypeBraceCompartment(hostView,", "stereotype);", "<START>", "if", "(compartment", "!=", "null)", "{", "<END>", "getDiagramEventBroker().addNotificationListener(helper.getStereotypeBraceCompartment(hostView,", "stereotype),", "this);", "}", "if", "(compartment", "!=", "null", "&&", "stereotype", "!=", "null)", "{", "EList<Property>", "properties", "=", "stereotype.allAttributes();", "for", "(Property", "property", ":", "properties)", "{", "getDiagramEventBroker().removeNotificationListener(helper.getStereotypePropertyInBrace(hostView,", "stereotype,", "property),", "this);", "}", "}", "}", "}", "}</code><technical_language>'null", "!='", "is", "preferably</technical_language>" ]
[ "public", "void", "removeListener()", "{", "View", "view", "=", "getView();", "if", "(null", "!=", "view)", "{", "getDiagramEventBroker().removeNotificationListener(view,", "this);", "if", "(null", "!=", "hostSemanticElement)", "{", "for", "(EObject", "stereotypeApplication", ":", "hostSemanticElement.getStereotypeApplications())", "{", "getDiagramEventBroker().removeNotificationListener(stereotypeApplication,", "this);", "}", "getDiagramEventBroker().removeNotificationListener(hostSemanticElement,", "this);", "hostSemanticElement", "=", "null;", "}", "}", "if", "(!stereotypeList.isEmpty())", "{", "for", "(Stereotype", "stereotype", ":", "stereotypeList)", "{", "View", "label", "=", "helper.getStereotypeLabel(hostView,", "stereotype);", "if", "(null", "!=", "label)", "{", "getDiagramEventBroker().removeNotificationListener(label,", "this);", "}", "BasicCompartment", "compartment", "=", "helper.getStereotypeBraceCompartment(hostView,", "stereotype);", "if", "(null", "!=", "compartment)", "{", "getDiagramEventBroker().addNotificationListener(helper.getStereotypeBraceCompartment(hostView,", "stereotype),", "this);", "}", "if", "(null", "!=", "compartment", "&&", "null", "!=", "stereotype)", "{", "EList<Property>", "properties", "=", "stereotype.allAttributes();", "for", "(Property", "property", ":", "properties)", "{", "getDiagramEventBroker().removeNotificationListener(helper.getStereotypePropertyInBrace(hostView,", "stereotype,", "property),", "this);", "}", "}", "}", "}", "}" ]
[ "<code>protected", "void", "reinitAllDatabases()", "throws", "IOException", "{", "boolean", "acquired", "=", "false;", "try", "{", "semaphore.acquire(Integer.MAX_VALUE);", "acquired", "=", "true;", "try", "{", "db.close();", "}", "catch", "(IOException", "e)", "{", "log.warnUnableToCloseDb(e);", "}", "try", "{", "expiredDb.close();", "}", "catch", "(IOException", "e)", "{", "log.warnUnableToCloseExpiredDb(e);", "}", "}", "catch", "(InterruptedException", "e)", "{", "log.warnUnableToCloseDb(e);", "log.warnUnableToCloseExpiredDb(e);", "}", "db", "=", "reinitDatabase(getQualifiedLocation(),", "dataDbOptions());", "expiredDb", "=", "reinitDatabase(getQualifiedExpiredLocation(),", "expiredDbOptions());", "if", "(acquired)", "{", "<START>", "semaphore.release(Integer.MAX_VALUE);", "<END>", "}", "}</code><technical_language>This", "done", "in", "a", "proper", "try", "finally", "block.", "If", "a", "reinitDatabase", "method", "threw", "IOException", "semaphore", "irreparably", "broken</technical_language>" ]
[ "protected", "void", "reinitAllDatabases()", "throws", "IOException", "{", "try", "{", "semaphore.acquire(Integer.MAX_VALUE);", "}", "catch", "(InterruptedException", "e)", "{", "throw", "new", "PersistenceException(\"Cannot", "acquire", "semaphore\",", "e);", "}", "try", "{", "if", "(stopped)", "{", "throw", "new", "PersistenceException(\"LevelDB", "is", "stopped\");", "}", "try", "{", "db.close();", "}", "catch", "(IOException", "e)", "{", "log.warnUnableToCloseDb(e);", "}", "try", "{", "expiredDb.close();", "}", "catch", "(IOException", "e)", "{", "log.warnUnableToCloseExpiredDb(e);", "}", "db", "=", "reinitDatabase(getQualifiedLocation(),", "dataDbOptions());", "expiredDb", "=", "reinitDatabase(getQualifiedExpiredLocation(),", "expiredDbOptions());", "}", "finally", "{", "semaphore.release(Integer.MAX_VALUE);", "}", "}" ]
[ "<code>public", "MatchClause", "append(Filter", "filter)", "{", "if", "(clause", "==", "null)", "{", "clause", "=", "new", "StringBuilder(\"MATCH", "(n)\");", "<START>", "if", "(filter.getRelationshipDirection().equals(Direction.INCOMING))", "{", "<END>", "clause.append(\"<\");", "}", "clause.append(String.format(\"-[%s:`%s`]-\",", "relationshipIdentifier(),", "this.relationshipType));", "if", "(filter.getRelationshipDirection().equals(Direction.OUTGOING))", "{", "clause.append(\">\");", "}", "clause.append(String.format(\"(%s)", "\",", "nodeIdentifier()));", "}", "clause.append(filter.toCypher(relationshipIdentifier(),", "clause.indexOf(\"", "WHERE", "\")", "==", "-1));", "return", "this;", "}</code><technical_language>suggestion", "if", "(filter.getRelationshipDirection()", "==", "Direction.INCOMING)", "{</technical_language>" ]
[ "public", "MatchClause", "append(Filter", "filter)", "{", "if", "(clause", "==", "null)", "{", "clause", "=", "new", "StringBuilder(\"MATCH", "(n)\");", "if", "(filter.getRelationshipDirection()", "==", "Direction.INCOMING)", "{", "clause.append(\"<\");", "}", "clause.append(String.format(\"-[%s:`%s`]-\",", "relationshipIdentifier(),", "this.relationshipType));", "if", "(filter.getRelationshipDirection()", "==", "Direction.OUTGOING)", "{", "clause.append(\">\");", "}", "clause.append(String.format(\"(%s)", "\",", "nodeIdentifier()));", "}", "clause.append(filter.toCypher(relationshipIdentifier(),", "clause.indexOf(\"", "WHERE", "\")", "==", "-1));", "return", "this;", "}" ]
[ "<code>public", "static", "AdjustableSweepBatchConfigSource", "create(", "MetricsManager", "metricsManager,", "Supplier<SweepBatchConfig>", "rawSweepBatchConfig)", "{", "AdjustableSweepBatchConfigSource", "configSource", "=", "new", "AdjustableSweepBatchConfigSource(rawSweepBatchConfig);", "Gauge<Double>", "gauge", "=", "AdjustableSweepBatchConfigSource::getBatchSizeMultiplier;", "metricsManager.addMetricFilter(AdjustableSweepBatchConfigSource.class,", "\"batchSizeMultiplier\",", "ImmutableMap.of(),", "<START>", "()", "->", "gauge.getValue()", "!=", "1.0);", "<END>", "metricsManager.registerMetric(AdjustableSweepBatchConfigSource.class,", "\"batchSizeMultiplier\",", "gauge);", "return", "configSource;", "}</code><technical_language>I", "confused", "b/w", "description", "implementation", "of", "filter", "here</technical_language>" ]
[ "public", "static", "AdjustableSweepBatchConfigSource", "create(", "MetricsManager", "metricsManager,", "Supplier<SweepBatchConfig>", "rawSweepBatchConfig)", "{", "AdjustableSweepBatchConfigSource", "configSource", "=", "new", "AdjustableSweepBatchConfigSource(rawSweepBatchConfig);", "Gauge<Double>", "gauge", "=", "AdjustableSweepBatchConfigSource::getBatchSizeMultiplier;", "metricsManager.addMetricFilter(AdjustableSweepBatchConfigSource.class,", "\"batchSizeMultiplier\",", "ImmutableMap.of(),", "()", "->", "gauge.getValue()", "<", "1.0);", "metricsManager.registerMetric(AdjustableSweepBatchConfigSource.class,", "\"batchSizeMultiplier\",", "gauge);", "return", "configSource;", "}" ]
[ "<code>public", "void", "configure(Binder", "binder)", "{", "JsonConfigProvider.bind(binder,", "\"druid.metadata.storage.tables\",", "MetadataStorageTablesConfig.class);", "JsonConfigProvider.bind(binder,", "\"druid.metadata.storage.connector\",", "MetadataStorageConnectorConfig.class);", "JsonConfigProvider.bind(binder,", "\"druid.manager.segments\",", "MetadataSegmentManagerConfig.class);", "JsonConfigProvider.bind(binder,", "\"druid.manager.rules\",", "MetadataRuleManagerConfig.class);", "binder.bind(PasswordProvider.class).toProvider(", "new", "Provider<PasswordProvider>()", "{", "@Inject", "MetadataStorageConnectorConfig", "metadataStorageConnectorConfig;", "@Inject", "Injector", "injector;", "@Override", "public", "PasswordProvider", "get()", "{", "final", "PasswordProvider", "passwordProvider;", "if", "(metadataStorageConnectorConfig", "==", "null", "||", "metadataStorageConnectorConfig.getPasswordProvider()", "==", "null)", "{", "JsonConfigProvider<PasswordProvider>", "provider", "=", "JsonConfigProvider.of(\"druid.password\",", "PasswordProvider.class);", "provider.inject(injector.getInstance(Properties.class),", "injector.getInstance(JsonConfigurator.class));", "<START>", "passwordProvider", "=", "provider.get().get();", "<END>", "}", "else", "{", "passwordProvider", "=", "metadataStorageConnectorConfig.getPasswordProvider();", "}", "injector.injectMembers(passwordProvider);", "return", "passwordProvider;", "}", "}", ");", "}</code><technical_language>Logging", "helpful", "warn", "users", "this", "happen</technical_language>" ]
[ "public", "void", "configure(Binder", "binder)", "{", "JsonConfigProvider.bind(binder,", "\"druid.metadata.storage.tables\",", "MetadataStorageTablesConfig.class);", "JsonConfigProvider.bind(binder,", "\"druid.metadata.storage.connector\",", "MetadataStorageConnectorConfig.class);", "JsonConfigProvider.bind(binder,", "\"druid.manager.segments\",", "MetadataSegmentManagerConfig.class);", "JsonConfigProvider.bind(binder,", "\"druid.manager.rules\",", "MetadataRuleManagerConfig.class);", "}" ]
[ "<code><START>", "public", "void", "testMigrationTask()", "throws", "InterruptedException", "{", "<END>", "MigrationTask", "migrationTask", "=", "new", "MigrationTask(project);", "migrationTask.start();", "Assert.assertTrue(migrationTask.isAlive());", "migrationTask.join();", "Assert.assertFalse(migrationTask.isAlive());", "Assert.assertEquals(100,", "migrationTask.getProgress());", "}</code><technical_language>test", "test,", "if", "metadata", "is", "migrated", ";-)</technical_language>" ]
[ "public", "void", "testMigrationTask()", "throws", "Exception", "{", "MigrationTask", "migrationTask", "=", "new", "MigrationTask(project);", "Field", "dataEditorServiceField", "=", "ServiceManager.class.getDeclaredField(\"dataEditorService\");", "dataEditorServiceField.setAccessible(true);", "Assert.assertTrue(Objects.isNull(dataEditorServiceField.get(null)));", "migrationTask.start();", "Assert.assertTrue(migrationTask.isAlive());", "migrationTask.join();", "Assert.assertTrue(Objects.nonNull(dataEditorServiceField.get(null)));", "Assert.assertFalse(migrationTask.isAlive());", "Assert.assertEquals(100,", "migrationTask.getProgress());", "Assert.assertNotNull(\"Process", "migration", "failed\",", "metsService.loadWorkpiece(processService.getMetadataFileUri(processService.getById(2))));", "}" ]
[ "<code>protected", "Object", "toNSCollection(ERXRestFormat.Delegate", "delegate,", "NSMutableDictionary<Object,", "Object>", "associatedObjects)", "{", "Object", "result", "=", "associatedObjects.get(_associatedObject);", "if", "(result", "==", "null)", "{", "if", "(delegate", "!=", "null)", "{", "delegate.nodeWillWrite(this);", "}", "if", "(isArray())", "{", "NSMutableArray<Object>", "array", "=", "new", "NSMutableArray<Object>();", "for", "(ERXRestRequestNode", "child", ":", "_children)", "{", "array.add(child.toNSCollection(delegate,", "associatedObjects));", "}", "result", "=", "array;", "}", "else", "if", "(isNull())", "{", "result", "=", "NSKeyValueCoding.NullValue;", "}", "else", "if", "(_value", "!=", "null)", "{", "result", "=", "_value;", "}", "else", "{", "NSMutableDictionary<Object,", "Object>", "dict", "=", "new", "NSMutableDictionary<Object,", "Object>();", "for", "(Map.Entry<String,", "Object>", "attribute", ":", "_attributes.entrySet())", "{", "String", "key", "=", "attribute.getKey();", "Object", "value", "=", "attribute.getValue();", "if", "(value", "==", "null)", "{", "value", "=", "NSKeyValueCoding.NullValue;", "}", "dict.put(key,", "value);", "}", "for", "(ERXRestRequestNode", "child", ":", "_children)", "{", "String", "name", "=", "child.name();", "Object", "value", "=", "child.toNSCollection(delegate,", "associatedObjects);", "<START>", "if", "(value", "!=", "NSKeyValueCoding.NullValue", "||", "ERXProperties.booleanForKeyWithDefault(\"ERXRest.includeNullValues\",", "true)", "==", "true)", "{", "<END>", "dict.put(name,", "value);", "}", "}", "if", "(dict.isEmpty())", "{", "result", "=", "NSKeyValueCoding.NullValue;", "}", "else", "{", "result", "=", "dict;", "}", "}", "if", "(_associatedObject", "!=", "null)", "{", "associatedObjects.put(_associatedObject,", "result);", "}", "}", "return", "result;", "}</code><technical_language>_==", "true_", "part", "is", "needed", "booleanForKeyWithDefault", "returns", "a", "boolean", ";)</technical_language>" ]
[ "protected", "Object", "toNSCollection(ERXRestFormat.Delegate", "delegate,", "NSMutableDictionary<Object,", "Object>", "associatedObjects)", "{", "Object", "result", "=", "associatedObjects.get(_associatedObject);", "if", "(result", "==", "null)", "{", "if", "(delegate", "!=", "null)", "{", "delegate.nodeWillWrite(this);", "}", "if", "(isArray())", "{", "NSMutableArray<Object>", "array", "=", "new", "NSMutableArray<Object>();", "for", "(ERXRestRequestNode", "child", ":", "_children)", "{", "array.add(child.toNSCollection(delegate,", "associatedObjects));", "}", "result", "=", "array;", "}", "else", "if", "(isNull())", "{", "result", "=", "NSKeyValueCoding.NullValue;", "}", "else", "if", "(_value", "!=", "null)", "{", "result", "=", "_value;", "}", "else", "{", "NSMutableDictionary<Object,", "Object>", "dict", "=", "new", "NSMutableDictionary<Object,", "Object>();", "for", "(Map.Entry<String,", "Object>", "attribute", ":", "_attributes.entrySet())", "{", "String", "key", "=", "attribute.getKey();", "Object", "value", "=", "attribute.getValue();", "if", "(value", "==", "null)", "{", "value", "=", "NSKeyValueCoding.NullValue;", "}", "dict.put(key,", "value);", "}", "for", "(ERXRestRequestNode", "child", ":", "_children)", "{", "String", "name", "=", "child.name();", "Object", "value", "=", "child.toNSCollection(delegate,", "associatedObjects);", "if", "(value", "!=", "NSKeyValueCoding.NullValue", "||", "ERXProperties.booleanForKeyWithDefault(\"ERXRest.includeNullValues\",", "true))", "{", "dict.put(name,", "value);", "}", "}", "if", "(dict.isEmpty())", "{", "result", "=", "NSKeyValueCoding.NullValue;", "}", "else", "{", "result", "=", "dict;", "}", "}", "if", "(_associatedObject", "!=", "null)", "{", "associatedObjects.put(_associatedObject,", "result);", "}", "}", "return", "result;", "}" ]
[ "<code>public", "User", "addUserToProject(final", "Project", "project,", "final", "Account", "account,", "final", "Role...", "userRoles)", "{", "notNull(project,", "\"project\");", "notNull(account,", "\"account\");", "notEmpty(account.getUri(),", "\"account.uri\");", "notNull(userRoles,", "\"userRoles\");", "validateRoleURIs(userRoles);", "<START>", "noNullElements(Arrays.stream(userRoles).map(Role::getUri).collect(Collectors.toList()),", "\"userRoles.uri\");", "<END>", "notEmpty(project.getId(),", "\"project.id\");", "final", "User", "user", "=", "new", "User(account,", "userRoles);", "doPostProjectUsersUpdate(project,", "user);", "return", "getUser(project,", "account);", "}</code><technical_language>redundant", "check</technical_language>" ]
[ "public", "User", "addUserToProject(final", "Project", "project,", "final", "Account", "account,", "final", "Role...", "userRoles)", "{", "notNull(project,", "\"project\");", "notNull(account,", "\"account\");", "notEmpty(account.getUri(),", "\"account.uri\");", "notNull(userRoles,", "\"userRoles\");", "validateRoleURIs(userRoles);", "notEmpty(project.getId(),", "\"project.id\");", "final", "User", "user", "=", "new", "User(account,", "userRoles);", "doPostProjectUsersUpdate(project,", "user);", "return", "getUser(project,", "account);", "}" ]
[ "<code>public", "void", "testDeadlock()", "throws", "Exception", "{", "doTest(1000", "*", "30);", "boolean", "<START>", "interrupted", "=", "<END>", "Thread.interrupted();", "if", "(interrupted)", "{", "fail(\"Thread", "was", "interrupted", "at", "end", "of", "test\");", "}", "}</code><technical_language>inline", "this", "variable</technical_language>" ]
[ "public", "void", "testDeadlock()", "throws", "Exception", "{", "doTest(1000", "*", "30);", "if", "(Thread.interrupted())", "{", "fail(\"Thread", "was", "interrupted", "at", "end", "of", "test\");", "}", "}" ]
[ "<code>public", "void", "makeSortable()", "{", "final", "Map<ImageResource,", "Integer>", "imageWeightMap", "=", "new", "HashMap<ImageResource,", "Integer>();", "imageWeightMap.put(statusCell.upImage,", "0);", "imageWeightMap.put(statusCell.volumeSomeBricksDownImage,", "1);", "imageWeightMap.put(statusCell.allBricksDownImage,", "2);", "imageWeightMap.put(statusCell.downImage,", "3);", "makeSortable(new", "Comparator<GlusterVolumeEntity>()", "{", "private", "final", "CustomStatusImageComaparator", "imageComparator", "=", "new", "CustomStatusImageComaparator(imageWeightMap);", "@Override", "public", "int", "compare(GlusterVolumeEntity", "o1,", "GlusterVolumeEntity", "o2)", "{", "<START>", "return", "imageComparator.compare(statusCell.getStatusImage(statusCell.getVolumeStatus(o1)),", "statusCell.getStatusImage(statusCell.getVolumeStatus(o2)));", "<END>", "}", "});", "}</code><technical_language>recalculating", "volume", "status", "here</technical_language>" ]
[ "public", "void", "makeSortable()", "{", "makeSortable(new", "Comparator<GlusterVolumeEntity>()", "{", "private", "final", "CustomStatusImageComaparator", "imageComparator", "=", "new", "CustomStatusImageComaparator();", "@Override", "public", "int", "compare(GlusterVolumeEntity", "o1,", "GlusterVolumeEntity", "o2)", "{", "return", "imageComparator.compare(VolumeStatusCell.getVolumeStatus(o1),", "VolumeStatusCell.getVolumeStatus(o2));", "}", "});", "}" ]
[ "<code>public", "GoldenEgg(UUID", "ownerId,", "CardSetInfo", "setInfo)", "{", "super(ownerId,", "setInfo,", "new", "CardType[]{CardType.ARTIFACT},", "\"{2}\");", "this.subtype.add(SubType.FOOD);", "this.addAbility(new", "EntersBattlefieldTriggeredAbility(new", "DrawCardSourceControllerEffect(1)));", "Ability", "ability", "=", "new", "AnyColorManaAbility(new", "GenericManaCost(1));", "ability.addCost(new", "TapSourceCost());", "ability.addCost(new", "SacrificeSourceCost());", "this.addAbility(ability);", "<START>", "Ability", "ability1", "=", "new", "SimpleActivatedAbility(Zone.BATTLEFIELD,", "new", "GainLifeEffect(3),", "new", "ManaCostsImpl(\"{1}\"));", "<END>", "ability1.addCost(new", "TapSourceCost());", "ability1.addCost(new", "SacrificeSourceCost());", "this.addAbility(ability1);", "}</code><technical_language>Costs", "2</technical_language>" ]
[ "public", "GoldenEgg(UUID", "ownerId,", "CardSetInfo", "setInfo)", "{", "super(ownerId,", "setInfo,", "new", "CardType[]{CardType.ARTIFACT},", "\"{2}\");", "this.subtype.add(SubType.FOOD);", "this.addAbility(new", "EntersBattlefieldTriggeredAbility(new", "DrawCardSourceControllerEffect(1)));", "Ability", "ability", "=", "new", "AnyColorManaAbility(new", "GenericManaCost(1));", "ability.addCost(new", "TapSourceCost());", "ability.addCost(new", "SacrificeSourceCost());", "this.addAbility(ability);", "Ability", "ability1", "=", "new", "SimpleActivatedAbility(Zone.BATTLEFIELD,", "new", "GainLifeEffect(3),", "new", "ManaCostsImpl(\"{2}\"));", "ability1.addCost(new", "TapSourceCost());", "ability1.addCost(new", "SacrificeSourceCost());", "this.addAbility(ability1);", "}" ]
[ "<code>public", "void", "unparse(SqlWriter", "writer,", "int", "leftPrec,", "int", "rightPrec)", "{", "writer.keyword(\"CREATE\");", "if", "(isTemporary())", "{", "writer.keyword(\"TEMPORARY\");", "}", "<START>", "if", "(getReplace())", "{", "writer.keyword(\"OR", "REPLACE\");", "}", "<END>", "writer.keyword(\"VIEW\");", "if", "(isIfNotExists())", "{", "writer.keyword(\"IF", "NOT", "EXISTS\");", "}", "viewName.unparse(writer,", "leftPrec,", "rightPrec);", "if", "(fieldList.size()", ">", "0)", "{", "fieldList.unparse(writer,", "1,", "rightPrec);", "}", "if", "(comment", "!=", "null)", "{", "writer.newlineAndIndent();", "writer.keyword(\"COMMENT\");", "comment.unparse(writer,", "leftPrec,", "rightPrec);", "}", "writer.newlineAndIndent();", "writer.keyword(\"AS\");", "writer.newlineAndIndent();", "query.unparse(writer,", "leftPrec,", "rightPrec);", "}</code><technical_language>remove", "this</technical_language>" ]
[ "public", "void", "unparse(SqlWriter", "writer,", "int", "leftPrec,", "int", "rightPrec)", "{", "writer.keyword(\"CREATE\");", "if", "(isTemporary())", "{", "writer.keyword(\"TEMPORARY\");", "}", "writer.keyword(\"VIEW\");", "if", "(isIfNotExists())", "{", "writer.keyword(\"IF", "NOT", "EXISTS\");", "}", "viewName.unparse(writer,", "leftPrec,", "rightPrec);", "if", "(fieldList.size()", ">", "0)", "{", "fieldList.unparse(writer,", "1,", "rightPrec);", "}", "if", "(comment", "!=", "null)", "{", "writer.newlineAndIndent();", "writer.keyword(\"COMMENT\");", "comment.unparse(writer,", "leftPrec,", "rightPrec);", "}", "writer.newlineAndIndent();", "writer.keyword(\"AS\");", "writer.newlineAndIndent();", "query.unparse(writer,", "leftPrec,", "rightPrec);", "}" ]
[ "<code>public", "void", "testValidCRAMFileWithoutSeqDict()", "throws", "Exception", "{", "final", "SamReader", "samReader", "=", "SamReaderFactory.", "makeDefault().", "validationStringency(ValidationStringency.SILENT).", "referenceSequence(new", "File(TEST_DATA_DIR,", "\"nm_tag_validation.fa\")).", "open(new", "File(TEST_DATA_DIR,", "\"nm_tag_validation.cram\"));", "<START>", "final", "ReferenceSequenceFile", "reference", "=", "new", "FastaSequenceFile(new", "File(TEST_DATA_DIR,", "\"nm_tag_validation.fa\"),", "true);", "<END>", "final", "Histogram<String>", "results", "=", "executeValidation(samReader,", "reference,", "IndexValidationStringency.EXHAUSTIVE);", "Assert.assertTrue(!results.isEmpty());", "}</code><technical_language>is", "index/dictionary", "involved:", "final", "ReferenceSequenceFile", "reference", "=", "new", "FastaSequenceFile(new", "File(TEST_DATA_DIR,", "\"nm_tag_validation.fa\"),", "true);", "final", "SamReader", "samReader", "=", "SamReaderFactory.", "makeDefault().", "validationStringency(ValidationStringency.SILENT).", "referenceSource(new", "ReferenceSource(reference)).", "..</technical_language>" ]
[ "public", "void", "testValidCRAMFileWithoutSeqDict()", "throws", "Exception", "{", "final", "File", "reference", "=", "new", "File(TEST_DATA_DIR,", "\"nm_tag_validation.fa\");", "final", "SamReader", "samReader", "=", "SamReaderFactory", ".makeDefault()", ".validationStringency(ValidationStringency.SILENT)", ".referenceSequence(reference)", ".open(new", "File(TEST_DATA_DIR,", "\"nm_tag_validation.cram\"));", "final", "Histogram<String>", "results", "=", "executeValidation(samReader,", "new", "FastaSequenceFile(reference,", "true),", "IndexValidationStringency.EXHAUSTIVE);", "Assert.assertTrue(!results.isEmpty());", "}" ]
[ "<code>public", "void", "cleanup()", "{", "if", "(model", "!=", "null)", "{", "model.cleanup();", "model", "=", "null;", "}", "<START>", "if", "(modelItems", "!=", "null)", "{", "for", "(T", "model:", "modelItems)", "{", "if", "(model", "instanceof", "HasCleanup)", "{", "((HasCleanup)model).cleanup();", "}", "}", "}", "<END>", "for", "(Pair<T,", "V>", "item", ":", "items)", "{", "T", "value", "=", "item.getFirst();", "if", "(!isGhost(value))", "{", "if", "(item", "instanceof", "HasCleanup)", "{", "((HasCleanup)value).cleanup();", "}", "}", "}", "cleanContentPanel();", "}</code><technical_language>do", "list,", "missed", "it</technical_language>" ]
[ "public", "void", "cleanup()", "{", "if", "(model", "!=", "null)", "{", "model.cleanup();", "model", "=", "null;", "}", "cleanupModelItems();", "for", "(Pair<T,", "V>", "item", ":", "items)", "{", "T", "value", "=", "item.getFirst();", "if", "(!isGhost(value))", "{", "if", "(item", "instanceof", "HasCleanup)", "{", "((HasCleanup)value).cleanup();", "}", "}", "}", "cleanContentPanel();", "}" ]
[ "<code>public", "String", "get(String", "name)", "{", "<START>", "return", "(isSet(name))", "?", "myRecord.get(name)", ":", "new", "String();", "<END>", "}</code><technical_language>return", "\"\"", "instead", "of", "new", "String()</technical_language>" ]
[ "public", "String", "get(String", "name)", "{", "return", "(isSet(name))", "?", "myRecord.get(name)", ":", "\"\";", "}" ]
[ "<code>private", "void", "updateMutePreviewOverlayVisibility()", "{", "mutePreviewOverlay.setVisibility(", "<START>", "showMuteOverlayOnVideoCall()", "&&", "muteButton.isChecked()", "&&", "!isInGreenScreenMode", "<END>", "?", "View.VISIBLE", ":", "View.GONE);", "}</code><technical_language>a", "tiny", "thing,", "I", "guess", "move", "condition", "assign", "statement,", "easier", "read", "conditional", "expression", "is", "complex", "now.", "int", "mutePreviewOverlayVisibility", "=", "showMuteOverlayOnVideoCall()", "&&", "muteButton.isChecked()", "&&", "!isInGreenScreenMode", "?", "View.VISIBLE", ":", "View.GONE;", "mutePreviewOverlay.setVisibility(mutePreviewOverlayVisibility);</technical_language>" ]
[ "private", "void", "updateMutePreviewOverlayVisibility()", "{", "int", "mutePreviewOverlayVisibility", "=", "showMuteOverlayOnVideoCall()", "&&", "muteButton.isChecked()", "&&", "!isInGreenScreenMode", "?", "View.VISIBLE", ":", "View.GONE;", "mutePreviewOverlay.setVisibility(mutePreviewOverlayVisibility);", "}" ]
[ "<code>public", "void", "resetAllResponses()", "{", "for", "(FeedbackQuestionAttributes", "question", ":", "questionResponseBundle.keySet())", "{", "<START>", "questionResponseBundle.putIfAbsent(question,", "new", "ArrayList<>());", "<END>", "}", "}</code><technical_language>emmmm", "i", "dont", "feel", "this", "replacement", "is", "necessary...and", "change", "code", "intends", "do,", "put", "replace", "question", "if", "question", "is", "a", "value,", "putIfAbsent", "associate", "question", "new", "ArrayList<>()", "if", "question", "is", "anything</technical_language>" ]
[ "public", "void", "resetAllResponses()", "{", "for", "(FeedbackQuestionAttributes", "question", ":", "questionResponseBundle.keySet())", "{", "questionResponseBundle.put(question,", "new", "ArrayList<FeedbackResponseAttributes>());", "}", "}" ]
[ "<code>protected", "URLConnection", "getExternalGraphic(AjaxRequestTarget", "target,", "Form<?>", "form)", "{", "onlineResource.processInput();", "if", "(onlineResource.getModelObject()", "!=", "null)", "{", "URL", "url", "=", "null;", "try", "{", "String", "baseUrl", "=", "baseURL(form);", "String", "external", "=", "onlineResource.getModelObject().toString();", "URI", "uri", "=", "new", "URI(", "external", ");", "if(", "uri.isAbsolute()", "){", "url", "=", "uri.toURL();", "if(", "!external.startsWith(baseUrl)){", "form.warn(", "\"Recommend", "use", "of", "styles", "directory", "at", "\"+baseUrl);", "}", "}", "else", "{", "<START>", "url", "=", "new", "URL(", "baseUrl", "+", "\"styles/\"+external", ");", "<END>", "}", "URLConnection", "conn", "=", "url.openConnection();", "if(\"text/html\".equals(conn.getContentType())){", "form.error(\"Unable", "to", "access", "url\");", "return", "null;", "}", "return", "conn;", "}", "catch", "(FileNotFoundException", "notFound", "){", "form.error(", "\"Unable", "to", "access", "\"+url);", "}", "catch", "(Exception", "e)", "{", "e.printStackTrace();", "form.error(", "\"Recommend", "use", "of", "styles", "directory", "at", "\"+e);", "}", "}", "return", "null;", "}</code><technical_language>This", "logic", "changes", "a", "bit", "due", "<LINK_0></technical_language>" ]
[ "protected", "URLConnection", "getExternalGraphic(AjaxRequestTarget", "target,", "Form<?>", "form)", "{", "onlineResource.processInput();", "if", "(onlineResource.getModelObject()", "!=", "null)", "{", "URL", "url", "=", "null;", "try", "{", "String", "baseUrl", "=", "baseURL(form);", "String", "external", "=", "onlineResource.getModelObject().toString();", "URI", "uri", "=", "new", "URI(", "external", ");", "if(", "uri.isAbsolute()", "){", "url", "=", "uri.toURL();", "if(", "!external.startsWith(baseUrl)){", "form.warn(", "\"Recommend", "use", "of", "styles", "directory", "at", "\"+baseUrl);", "}", "}", "else", "{", "WorkspaceInfo", "wsInfo", "=", "((StyleInfo)getDefaultModelObject()).getWorkspace();", "if", "(wsInfo", "!=", "null)", "{", "url", "=", "new", "URL(", "baseUrl", "+", "\"styles/\"+wsInfo.getName()+\"/\"+external", ");", "}", "else", "{", "url", "=", "new", "URL(", "baseUrl", "+", "\"styles/\"+external", ");", "}", "}", "URLConnection", "conn", "=", "url.openConnection();", "if(\"text/html\".equals(conn.getContentType())){", "form.error(\"Unable", "to", "access", "url\");", "return", "null;", "}", "return", "conn;", "}", "catch", "(FileNotFoundException", "notFound", "){", "form.error(", "\"Unable", "to", "access", "\"+url);", "}", "catch", "(Exception", "e)", "{", "e.printStackTrace();", "form.error(", "\"Recommend", "use", "of", "styles", "directory", "at", "\"+e);", "}", "}", "return", "null;", "}" ]
[ "<code>private", "void", "loadButtonAction(ActionEvent", "e)", "{", "progressDialog", "=", "new", "ProgressDialog(list.getParent());", "if", "(dbpath", "==", "SELECT_OPTION)", "{", "<START>", "File", "dir", "=", "selectDirectory();", "<END>", "if", "(dir", "==", "null)", "{", "return;", "}", "}", "dbload.restart();", "}</code><technical_language>If", "dir", "is", "anywhere,", "do", "if", "(selectDirectory()", "==", "null)</technical_language>" ]
[ "private", "void", "loadButtonAction(ActionEvent", "e)", "{", "loadDB();", "}" ]
[ "<code>public", "Single<String>", "getP18ForItem(String", "entityId)", "{", "return", "depictsInterface.getLabelForEntity(entityId)", ".map(response", "->", "{", "String", "name;", "try", "{", "JsonObject", "claims", "=", "response.getAsJsonObject(\"claims\").getAsJsonObject();", "<START>", "JsonObject", "P18", "=", "claims.get(\"P18\").getAsJsonArray().get(0).getAsJsonObject();", "<END>", "JsonObject", "mainsnak", "=", "P18.get(\"mainsnak\").getAsJsonObject();", "JsonObject", "datavalue", "=", "mainsnak.get(\"datavalue\").getAsJsonObject();", "JsonPrimitive", "value", "=", "datavalue.get(\"value\").getAsJsonPrimitive();", "name", "=", "value.toString();", "name", "=", "name.substring(1,", "name.length()", "-", "1);", "}", "catch", "(Exception", "e)", "{", "name=\"\";", "}", "if", "(!name.isEmpty()){", "return", "getImageUrl(name);", "}", "else", "return", "\"No", "Image", "for", "Depiction\";", "})", ".singleOrError();", "}</code><technical_language>Java", "convention", "for", "a", "variable", "p18", "lowercase</technical_language>" ]
[ "public", "Single<String>", "getP18ForItem(String", "entityId)", "{", "return", "depictsInterface.getImageForEntity(entityId)", ".map(commonsFilename", "->", "{", "String", "name;", "try", "{", "JsonObject", "claims", "=", "commonsFilename.getAsJsonObject(\"claims\").getAsJsonObject();", "JsonObject", "p18", "=", "claims.get(\"P18\").getAsJsonArray().get(0).getAsJsonObject();", "JsonObject", "mainsnak", "=", "p18.get(\"mainsnak\").getAsJsonObject();", "JsonObject", "datavalue", "=", "mainsnak.get(\"datavalue\").getAsJsonObject();", "JsonPrimitive", "value", "=", "datavalue.get(\"value\").getAsJsonPrimitive();", "name", "=", "value.toString();", "name", "=", "name.substring(1,", "name.length()", "-", "1);", "}", "catch", "(Exception", "e)", "{", "name=\"\";", "}", "if", "(!name.isEmpty()){", "return", "getThumbnailUrl(name);", "}", "else", "return", "NO_DEPICTED_IMAGE;", "})", ".singleOrError();", "}" ]
[ "<code>public", "String", "getServerState()", "{", "this.officeServer.refreshState();", "<START>", "return", "contextualLocalizationManager.getTranslationPlain(", "<END>", "TRANSLATION_KEY_SERVER_STATE_PREFIX", "+", "this.officeServer.getState().name().toLowerCase());", "}</code><technical_language>Small", "detail:", "missing", "this..", "line", "replaced", "for", "ex</technical_language>" ]
[ "public", "String", "getServerState()", "{", "this.officeServer.refreshState();", "String", "normalizedStatusKey", "=", "CaseUtils.toCamelCase(this.officeServer.getState().name().toLowerCase(),", "false,", "'_');", "return", "this.contextualLocalizationManager", ".getTranslationPlain(TRANSLATION_KEY_SERVER_STATE_PREFIX", "+", "normalizedStatusKey);", "}" ]
[ "<code>public", "void", "visitToken(DetailAST", "token)", "{", "switch", "(token.getType())", "{", "<START>", "case", "TokenTypes.INTERFACE_DEF:", "<END>", "checkServiceInterface(token);", "break;", "default:", "break;", "}", "}</code><technical_language>is", "case", "here.", "replace", "this", "switch", "statement", "if</technical_language>" ]
[ "public", "void", "visitToken(DetailAST", "token)", "{", "if", "(token.getType()", "==", "TokenTypes.INTERFACE_DEF)", "{", "checkServiceInterface(token);", "}", "}" ]
[ "<code>public", "DeCoupleMBusDeviceCommandExecutor()", "{", "<START>", "super(MbusChannelElementsDto.class);", "<END>", "}</code><technical_language>class", "passed", "super", "constructor", "MbusChannelElementsDto.", "I", "cleanest", "pass", "DecoupleMbusDto.class", "(and", "DecoupleMbusDto", "implement", "ActionRequestDto)</technical_language>" ]
[ "public", "DeCoupleMBusDeviceCommandExecutor()", "{", "super(DeCoupleMbusDeviceDto.class);", "}" ]
[ "<code>public", "ServerWebSocketInitializer(final", "ServerInfo", "serverInfo)", "{", "<START>", "LOG.info(\"Currently", "time", "out", "time", "is", "not", "used", "\"", "+", "serverInfo.getTimeOut());", "<END>", "this.serverInfo", "=", "serverInfo;", "connectionServer", "=", "createServerSocket();", "manager", "=", "createConnectionManager(getServerInfo());", "}</code><technical_language>Colon", "\"used\"</technical_language>" ]
[ "public", "ServerWebSocketInitializer(final", "ServerInfo", "serverInfo)", "{", "LOG.info(\"Currently", "time", "out", "time", "is", "not", "used:", "\"", "+", "serverInfo.getTimeOut());", "this.serverInfo", "=", "serverInfo;", "connectionServer", "=", "createServerSocket();", "manager", "=", "createConnectionManager(getServerInfo());", "}" ]
[ "<code>public", "ArrayList<OncoTreeNode>", "getOncoTree(Version", "version)", "throws", "TopBraidException", "{", "<START>", "ArrayList<OncoTreeNode>", "list", "=", "new", "ArrayList<OncoTreeNode>(super.query(String.format(query,", "version.getGraphURI()),", "new", "ParameterizedTypeReference<List<OncoTreeNode>>(){}));", "<END>", "return", "list;", "}</code><technical_language>I", "guess", "getOncoTree()", "returns", "List<OncoTreeNode>", "return", "ArrayList<OncoTreeNode>", "?", "Still,", "need", "create", "a", "named", "variable", "..", "do:", "return", "new", "ArrayList<OncoTreeNode>(super.query", "...</technical_language>" ]
[ "public", "ArrayList<OncoTreeNode>", "getOncoTree(Version", "version)", "throws", "TopBraidException", "{", "return", "new", "ArrayList<OncoTreeNode>(super.query(String.format(query,", "version.getGraphURI()),", "new", "ParameterizedTypeReference<List<OncoTreeNode>>(){}));", "}" ]
[ "<code>public", "void", "doSample()", "{", "<START>", "sendData(pm.isScreenOn()?\"on\":\"off\");", "<END>", "}</code><technical_language>@orhan89", "while", "add", "it,", "do", "a", "API", "version", "check", "isInteractive()", "if", "available?<LINK_0></technical_language>" ]
[ "public", "void", "doSample()", "{", "boolean", "isScreenActive;", "if", "(Build.VERSION.SDK_INT", ">=", "Build.VERSION_CODES.KITKAT_WATCH)", "{", "isScreenActive", "=", "pm.isInteractive();", "}", "else", "{", "isScreenActive", "=", "pm.isScreenOn();", "}", "sendData(isScreenActive?\"on\":\"off\");", "}" ]
[ "<code><START>", "public", "Configuration", "setDefaults(Configuration", "defaults)", "<END>", "{", "this.defaults", "=", "defaults;", "return", "this;", "}</code><technical_language>I", "suggest", "check", "defaults", "!=", "this", "setting</technical_language>" ]
[ "public", "Configuration", "setDefaults(Configuration", "defaults)", "{", "if", "(", "defaults", "==", "this", ")", "{", "throw", "new", "IllegalArgumentException(", "\"Can't", "set", "self", "as", "defaults\"", ");", "}", "this.defaults", "=", "defaults;", "return", "this;", "}" ]
[ "<code>public", "void", "refreshMetadata(String", "username)", "{", "if", "(mNosaraClient", "==", "null)", "{", "return;", "}", "if", "(!TextUtils.isEmpty(username))", "{", "mUserName", "=", "username;", "if", "(getAnonID()", "!=", "null)", "{", "<START>", "mNosaraClient.trackAliasUser(mUserName,", "getAnonID());", "<END>", "clearAnonID();", "}", "}", "else", "{", "mUserName", "=", "null;", "if", "(getAnonID()", "==", "null)", "{", "generateNewAnonID();", "}", "}", "}</code><technical_language>is", "a", "problem", ":cry:", ":disappointed:", "need", "change", "library", "trackaliasUser", "TracksClient.NosaraUserType.WPCOM", "(wpcom:user_id)", "internally.", "add", "another", "trackaliasUser", "method", "takes", "userType", "parameter...</technical_language>" ]
[ "public", "void", "refreshMetadata(String", "username)", "{", "if", "(mNosaraClient", "==", "null)", "{", "return;", "}", "if", "(!TextUtils.isEmpty(username))", "{", "mUserName", "=", "username;", "if", "(getAnonID()", "!=", "null)", "{", "mNosaraClient.trackAliasUser(mUserName,", "getAnonID(),", "TracksClient.NosaraUserType.SIMPLENOTE);", "clearAnonID();", "}", "}", "else", "{", "mUserName", "=", "null;", "if", "(getAnonID()", "==", "null)", "{", "generateNewAnonID();", "}", "}", "}" ]
[ "<code>private", "void", "removeHiddenInstructors(FeedbackQuestionAttributes", "question,", "List<FeedbackResponseAttributes>", "responses,", "Map<String,", "String>", "recipients,", "Set<String>", "hiddenInstructorEmails)", "{", "<START>", "boolean", "noChangeRequired", "=", "hiddenInstructorEmails", "==", "null", "<END>", "||", "hiddenInstructorEmails.isEmpty()", "||", "question.getRecipientType()", "!=", "FeedbackParticipantType.INSTRUCTORS;", "if", "(noChangeRequired)", "{", "return;", "}", "for", "(String", "instructorEmail", ":", "hiddenInstructorEmails)", "{", "if", "(recipients.containsKey(instructorEmail))", "{", "recipients.remove(instructorEmail);", "}", "Iterator<FeedbackResponseAttributes>", "iterResponse", "=", "responses.iterator();", "while", "(iterResponse.hasNext())", "{", "FeedbackResponseAttributes", "response", "=", "iterResponse.next();", "if", "(response.recipientEmail.equals(instructorEmail))", "{", "iterResponse.remove();", "}", "}", "}", "}</code><technical_language>@unyoungwax,", "oops", "missed", "this,", "consider", "prefixing", "this", "boolean", "<code>is...</code></technical_language>" ]
[ "private", "void", "removeHiddenInstructors(FeedbackQuestionAttributes", "question,", "List<FeedbackResponseAttributes>", "responses,", "Map<String,", "String>", "recipients,", "Set<String>", "hiddenInstructorEmails)", "{", "boolean", "isNoChangeRequired", "=", "hiddenInstructorEmails", "==", "null", "||", "hiddenInstructorEmails.isEmpty()", "||", "question.getRecipientType()", "!=", "FeedbackParticipantType.INSTRUCTORS;", "if", "(isNoChangeRequired)", "{", "return;", "}", "for", "(String", "instructorEmail", ":", "hiddenInstructorEmails)", "{", "if", "(recipients.containsKey(instructorEmail))", "{", "recipients.remove(instructorEmail);", "}", "Iterator<FeedbackResponseAttributes>", "iterResponse", "=", "responses.iterator();", "while", "(iterResponse.hasNext())", "{", "FeedbackResponseAttributes", "response", "=", "iterResponse.next();", "if", "(response.recipientEmail.equals(instructorEmail))", "{", "iterResponse.remove();", "}", "}", "}", "}" ]
[ "<code>private", "void", "cancelUpload(int", "localMediaId)", "{", "if", "(mCurrentUpload", "!=", "null", "&&", "mCurrentUpload.getId()", "==", "localMediaId)", "{", "cancelCurrentUpload();", "}", "for(Iterator<MediaModel>", "i", "=", "mQueue.iterator();", "i.hasNext();)", "{", "MediaModel", "mediaModel", "=", "i.next();", "if", "(mediaModel.getId()", "==", "localMediaId)", "{", "<START>", "i.remove();", "<END>", "}", "}", "}</code><technical_language>nitpicking:", "nice", "break", "loop</technical_language>" ]
[ "private", "void", "cancelUpload(int", "localMediaId)", "{", "if", "(mCurrentUpload", "!=", "null", "&&", "mCurrentUpload.getId()", "==", "localMediaId)", "{", "cancelCurrentUpload();", "}", "for(Iterator<MediaModel>", "i", "=", "mUploadQueue.iterator();", "i.hasNext();)", "{", "MediaModel", "mediaModel", "=", "i.next();", "if", "(mediaModel.getId()", "==", "localMediaId)", "{", "i.remove();", "}", "}", "}" ]
[ "<code>MergingUpdater(AbstractTripleStore", "database)", "{", "this.database", "=", "database;", "String", "property", "=", "<START>", "System.getProperty(\"outputDumps\");", "<END>", "outputDumps", "=", "Boolean.TRUE.toString().equals(property);", "id", "=", "UUID.randomUUID().toString().replaceAll(\"-\",", "\"\");", "}</code><technical_language>configuration", "injected,", "read", "system", "properties", "in", "constructor</technical_language>" ]
[ "MergingUpdater(AbstractTripleStore", "database)", "{", "this(database,", "false);", "}" ]
[ "<code><START>", "protected", "org.spine3.server.storage.EventStorage", "createStorage(StorageFactory", "factory)", "{", "<END>", "final", "RecordStorage<EventId>", "recordStorage", "=", "super.createStorage(factory);", "final", "org.spine3.server.storage.EventStorage", "storage", "=", "factory.createEventStorage(recordStorage);", "return", "storage;", "}</code><technical_language>avoid", "FQNs", "can</technical_language>" ]
[ "protected", "EventRecordStorage", "createStorage(StorageFactory", "factory)", "{", "final", "RecordStorage<EventId>", "recordStorage", "=", "super.createStorage(factory);", "final", "EventRecordStorage", "storage", "=", "factory.createEventStorage(recordStorage);", "return", "storage;", "}" ]
[ "<code>public", "int", "getLength()", "{", "Widget", "widget", "=", "getWidget();", "int", "childCount", "=", "0;", "if", "(widget", "instanceof", "Composite)", "{", "childCount", "=", "((Composite)", "widget).getChildren().length;", "if", "(widget", "instanceof", "CTabFolder)", "{", "for", "(CTabItem", "tabItem", ":", "((CTabFolder)", "widget).getItems())", "{", "if", "(tabItem.isDisposed())", "{", "<START>", "System.err.println(\"CTabItem", "was", "disposed\");", "<END>", "break;", "}", "else", "{", "childCount++;", "}", "}", "}", "}", "return", "childCount;", "}</code><technical_language>syserr", "out</technical_language>" ]
[ "public", "int", "getLength()", "{", "Widget", "widget", "=", "getWidget();", "int", "childCount", "=", "0;", "if", "(widget", "instanceof", "Composite)", "{", "childCount", "=", "((Composite)", "widget).getChildren().length;", "if", "(widget", "instanceof", "CTabFolder)", "{", "for", "(CTabItem", "tabItem", ":", "((CTabFolder)", "widget).getItems())", "{", "if", "(tabItem.isDisposed())", "{", "break;", "}", "else", "{", "childCount++;", "}", "}", "}", "}", "return", "childCount;", "}" ]
[ "<code>static", "org.ovirt.engine.core.common.businessentities.VM", "setUpEntityExpectations(", "org.ovirt.engine.core.common.businessentities.VM", "entity,", "VmStatistics", "statistics,", "int", "index)", "{", "expect(entity.getId()).andReturn(GUIDS[index]).anyTimes();", "expect(entity.getvds_group_id()).andReturn(GUIDS[2]).anyTimes();", "expect(entity.getvm_name()).andReturn(NAMES[index]).anyTimes();", "expect(entity.getvm_description()).andReturn(DESCRIPTIONS[index]).anyTimes();", "expect(entity.getnum_of_cpus()).andReturn(8).anyTimes();", "expect(entity.getnum_of_sockets()).andReturn(2).anyTimes();", "expect(entity.getusage_mem_percent()).andReturn(Integer.valueOf(20)).anyTimes();", "expect(entity.getdisplay_type()).andReturn(DisplayType.vnc).anyTimes();", "expect(entity.getdisplay_secure_port()).andReturn(5900).anyTimes();", "expect(entity.getnum_of_monitors()).andReturn(2).anyTimes();", "expect(entity.getvm_type()).andReturn(VmType.Server).anyTimes();", "expect(entity.getrun_on_vds_name()).andReturn(NAMES[NAMES.length", "-", "1]).anyTimes();", "Map<String,", "DiskImage>", "diskImageMap", "=", "new", "HashMap<String,", "DiskImage>();", "diskImageMap.put(\"1\",", "new", "DiskImage());", "expect(entity.getDiskMap()).andReturn(diskImageMap).anyTimes();", "VmStatic", "vmStatic", "=", "new", "VmStatic();", "vmStatic.setId(GUIDS[index]);", "vmStatic.setvm_name(NAMES[index]);", "<START>", "expect(entity.getStaticData()).andReturn(vmStatic).anyTimes();", "<END>", "setUpStatisticalEntityExpectations(entity,", "statistics);", "return", "entity;", "}</code><technical_language>this", "expectations", "relevant", "for", "use-case", "only,", "need", "for", "tests", "them,", "please", "move", "method", "extend", "expectations", "for", "setUpEntityExpectations()</technical_language>" ]
[ "static", "org.ovirt.engine.core.common.businessentities.VM", "setUpEntityExpectations(", "org.ovirt.engine.core.common.businessentities.VM", "entity,", "VmStatistics", "statistics,", "int", "index)", "{", "expect(entity.getId()).andReturn(GUIDS[index]).anyTimes();", "expect(entity.getvds_group_id()).andReturn(GUIDS[2]).anyTimes();", "expect(entity.getvm_name()).andReturn(NAMES[index]).anyTimes();", "expect(entity.getvm_description()).andReturn(DESCRIPTIONS[index]).anyTimes();", "expect(entity.getnum_of_cpus()).andReturn(8).anyTimes();", "expect(entity.getnum_of_sockets()).andReturn(2).anyTimes();", "expect(entity.getusage_mem_percent()).andReturn(Integer.valueOf(20)).anyTimes();", "expect(entity.getdisplay_type()).andReturn(DisplayType.vnc).anyTimes();", "expect(entity.getdisplay_secure_port()).andReturn(5900).anyTimes();", "expect(entity.getnum_of_monitors()).andReturn(2).anyTimes();", "expect(entity.getvm_type()).andReturn(VmType.Server).anyTimes();", "expect(entity.getrun_on_vds_name()).andReturn(NAMES[NAMES.length", "-", "1]).anyTimes();", "setUpStatisticalEntityExpectations(entity,", "statistics);", "return", "entity;", "}" ]
[ "<code>public", "List<String>", "getDirectory()", "throws", "OwException", "{", "List<String>", "directory", "=", "new", "ArrayList<String>();", "OwserverPacket", "requestPacket", "=", "new", "OwserverPacket(OwserverMessageType.DIR,", "\"/\");", "write(requestPacket);", "OwserverPacket", "returnPacket", "=", "null;", "do", "{", "try", "{", "returnPacket", "=", "read(false);", "}", "catch", "(OwException", "e)", "{", "<START>", "logger.info(\"getDirectory", "may", "have", "returned", "incomplete", "result:", "{}\",", "e.getMessage());", "<END>", "closeOnError();", "return", "directory;", "}", "if", "(returnPacket.hasPayload())", "{", "directory.add(returnPacket.getPayloadString());", "}", "}", "while", "((returnPacket.isPingPacket()", "||", "returnPacket.hasPayload()));", "if", "(!returnPacket.hasControlFlag(OwserverControlFlag.PERSISTENCE))", "{", "logger.trace(\"closing", "connection", "because", "persistence", "was", "denied\");", "close();", "}", "connectionErrorCounter", "=", "0;", "return", "directory;", "}</code><technical_language>Is", "a", "software", "issue?", "do", "WARN", "include", "exception", "a", "param</technical_language>" ]
[ "public", "List<String>", "getDirectory()", "throws", "OwException", "{", "List<String>", "directory", "=", "new", "ArrayList<String>();", "OwserverPacket", "requestPacket", "=", "new", "OwserverPacket(OwserverMessageType.DIR,", "\"/\");", "write(requestPacket);", "OwserverPacket", "returnPacket", "=", "null;", "do", "{", "try", "{", "returnPacket", "=", "read(false);", "}", "catch", "(OwException", "e)", "{", "logger.debug(\"getDirectory", "may", "have", "returned", "incomplete", "result:", "{}\",", "e.getMessage());", "closeOnError();", "return", "directory;", "}", "if", "(returnPacket.hasPayload())", "{", "directory.add(returnPacket.getPayloadString());", "}", "}", "while", "((returnPacket.isPingPacket()", "||", "returnPacket.hasPayload()));", "if", "(!returnPacket.hasControlFlag(OwserverControlFlag.PERSISTENCE))", "{", "logger.trace(\"closing", "connection", "because", "persistence", "was", "denied\");", "close();", "}", "connectionErrorCounter", "=", "0;", "return", "directory;", "}" ]
[ "<code>public", "void", "start()", "throws", "Exception", "{", "synchronized", "(lock)", "{", "if", "(childrenCache", "!=", "null)", "{", "return;", "}", "childrenCache", "=", "cacheFactory.make(curatorFramework,", "config.getContainerPath());", "}", "ContainerCacheListener", "containerCacheListener", "=", "new", "ContainerCacheListener();", "childrenCache.getListenable().addListener(containerCacheListener);", "try", "{", "childrenCache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);", "}", "catch", "(Exception", "e)", "{", "synchronized", "(lock)", "{", "try", "{", "stop();", "}", "catch", "(IOException", "e1)", "{", "log.error(e1,", "\"Exception", "when", "stopping", "InventoryManager", "that", "couldn't", "start.\");", "}", "}", "throw", "e;", "}", "<START>", "while", "(!containerCacheListener.doneInitializing)", "{", "<END>", "Thread.sleep(2000);", "log.info(\"Waiting", "for", "PathChildrenCache", "to", "be", "completely", "loaded.\");", "}", "}</code><technical_language>a", "CountDownLatch.await(1", "minute)", "instead?", "logs", "printed", "wait", "more", "necessary</technical_language>" ]
[ "public", "void", "start()", "throws", "Exception", "{", "synchronized", "(lock)", "{", "if", "(childrenCache", "!=", "null)", "{", "return;", "}", "childrenCache", "=", "cacheFactory.make(curatorFramework,", "config.getContainerPath());", "}", "ContainerCacheListener", "containerCacheListener", "=", "new", "ContainerCacheListener();", "childrenCache.getListenable().addListener(containerCacheListener);", "try", "{", "childrenCache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);", "}", "catch", "(Exception", "e)", "{", "synchronized", "(lock)", "{", "try", "{", "stop();", "}", "catch", "(IOException", "e1)", "{", "log.error(e1,", "\"Exception", "when", "stopping", "InventoryManager", "that", "couldn't", "start.\");", "}", "}", "throw", "e;", "}", "while", "(!latch.await(1,", "TimeUnit.MINUTES))", "{", "log.info(\"Waiting", "for", "PathChildrenCache", "to", "be", "completely", "loaded.\");", "}", "log.info(\"PathChildrenCache", "has", "been", "loaded.\");", "}" ]
[ "<code>public", "void", "testDoubletonFlatbush()", "{", "<START>", "List<Rectangle>", "items", "=", "new", "ArrayList<>();", "<END>", "Rectangle", "rect0", "=", "new", "Rectangle(1,", "1,", "1,", "1);", "items.add(rect0);", "Rectangle", "rect1", "=", "new", "Rectangle(-1,", "-2,", "-1,", "-1);", "items.add(rect1);", "items.sort(RECTANGLE_COMPARATOR);", "Flatbush<Rectangle>", "rtree", "=", "new", "Flatbush<>(items.toArray(new", "Rectangle[]", "{}));", "List<Rectangle>", "allResults", "=", "findIntersections(rtree,", "EVERYTHING);", "allResults.sort(RECTANGLE_COMPARATOR);", "assertEquals(allResults,", "items);", "Rectangle", "hit0", "=", "new", "Rectangle(1,", "1,", "2,", "2);", "assertEquals(findIntersections(rtree,", "hit0),", "ImmutableList.of(rect0));", "Rectangle", "hit1", "=", "new", "Rectangle(-2,", "-2,", "-1,", "-2);", "assertEquals(findIntersections(rtree,", "hit1),", "ImmutableList.of(rect1));", "Rectangle", "totalMiss", "=", "new", "Rectangle(10,", "10,", "12,", "12);", "assertEquals(findIntersections(rtree,", "totalMiss),", "ImmutableList.of());", "Rectangle", "marginalMiss", "=", "new", "Rectangle(0,", "0,", "0,", "0);", "assertEquals(findIntersections(rtree,", "marginalMiss),", "ImmutableList.of());", "}</code><technical_language>ImmutableList.of()", "assertEqualsNoOrder", "Rectangle", "rect0", "=", "new", "Rectangle(1,", "1,", "1,", "1);", "Rectangle", "rect1", "=", "new", "Rectangle(-1,", "-2,", "-1,", "-1);", "List<Rectangle>", "items", "=", "ImmutableList.of(rect0,", "rect1);", "Flatbush<Rectangle>", "rtree", "=", "new", "Flatbush<>(items.toArray(new", "Rectangle[]", "{}));", "List<Rectangle>", "allResults", "=", "findIntersections(rtree,", "EVERYTHING);", "assertEqualsNoOrder(allResults.toArray(),", "items.toArray());", "ditto", "testTwoLevelFlatbush</technical_language>" ]
[ "public", "void", "testDoubletonFlatbush()", "{", "Rectangle", "rect0", "=", "new", "Rectangle(1,", "1,", "1,", "1);", "Rectangle", "rect1", "=", "new", "Rectangle(-1,", "-2,", "-1,", "-1);", "List<Rectangle>", "items", "=", "ImmutableList.of(rect0,", "rect1);", "Flatbush<Rectangle>", "rtree", "=", "new", "Flatbush<>(items.toArray(new", "Rectangle[]", "{}));", "List<Rectangle>", "allResults", "=", "findIntersections(rtree,", "EVERYTHING);", "assertEqualsSorted(allResults,", "items,", "RECTANGLE_COMPARATOR);", "assertEquals(findIntersections(rtree,", "new", "Rectangle(1,", "1,", "2,", "2)),", "ImmutableList.of(rect0));", "assertEquals(findIntersections(rtree,", "new", "Rectangle(-2,", "-2,", "-1,", "-2)),", "ImmutableList.of(rect1));", "assertEquals(findIntersections(rtree,", "new", "Rectangle(10,", "10,", "12,", "12)),", "ImmutableList.of());", "assertEquals(findIntersections(rtree,", "new", "Rectangle(0,", "0,", "0,", "0)),", "ImmutableList.of());", "}" ]
[ "<code>public", "void", "onDeniedPendingLockNotification()", "{", "synchronized", "(ZKDistributedNonblockingLock.this)", "{", "<START>", "_isLocked", "=", "false;", "<END>", "_isPreempted", "=", "true;", "_isPending", "=", "false;", "ZKDistributedNonblockingLock.this.notify();", "}", "}</code><technical_language>a", "lock", "in", "state", "a", "time.", "I", "suggest", "merging", "2", "booleans", "enum", "for", "cleanness", "of", "code", "logic</technical_language>" ]
[ "public", "void", "onDeniedPendingLockNotification()", "{", "_lockStatus", "=", "LockConstants.LockStatus.PREEMPTED;", "_countDownLatch.countDown();", "}" ]
[ "<code>public", "void", "generateExperimentalCoordinates(Vector2d", "firstBondVector)", "throws", "CDKException", "{", "IMolecule", "original", "=", "molecule;", "IMolecule", "shallowCopy", "=", "molecule.getBuilder().newInstance(IMolecule.class,molecule);", "for", "(IAtom", "curAtom", ":", "shallowCopy.atoms())", "{", "if", "(curAtom.getSymbol().equals(\"H\"))", "{", "int", "bondsFromCurAtom=0;", "for", "(IBond", "bond", ":", "shallowCopy.bonds())", "if(bond.contains", "(curAtom))", "++bondsFromCurAtom;", "<START>", "if", "(bondsFromCurAtom", "<", "2)", "{", "<END>", "shallowCopy.removeAtomAndConnectedElectronContainers(curAtom);", "curAtom.setPoint2d(null);", "}", "}", "}", "molecule", "=", "shallowCopy;", "generateCoordinates(firstBondVector);", "double", "bondLength", "=", "GeometryTools.getBondLengthAverage(molecule);", "HydrogenPlacer", "hPlacer", "=", "new", "HydrogenPlacer();", "molecule", "=", "original;", "hPlacer.placeHydrogens2D(molecule,", "bondLength);", "}</code><technical_language>IAtomContainer.getConnectedBondsCount()?", "IAtomContainer.getConnectedAtomsCount()?", "<LINK_0></technical_language>" ]
[ "public", "void", "generateExperimentalCoordinates(Vector2d", "firstBondVector)", "throws", "CDKException", "{", "IMolecule", "original", "=", "molecule;", "IMolecule", "shallowCopy", "=", "molecule.getBuilder().newInstance(IMolecule.class,molecule);", "Map<IAtom,Integer>", "single_h", "=", "new", "HashMap<IAtom,Integer>();", "for", "(IBond", "curBond", ":", "shallowCopy.bonds())", "{", "boolean", "first", "=", "curBond.getAtom(0).getSymbol().equals(\"H\");", "boolean", "second", "=", "curBond.getAtom(1).getSymbol().equals(\"H\");", "if", "(first", "&&", "!second)", "single_h.put(curBond.getAtom(0),", "0);", "if", "(!first", "&&", "second)", "single_h.put(curBond.getAtom(1),", "0);", "}", "for", "(IAtom", "curAtom", ":", "single_h.keySet())", "{", "if", "(shallowCopy.getConnectedBondsCount(curAtom)", "==", "1)", "{", "shallowCopy.removeAtomAndConnectedElectronContainers(curAtom);", "}", "}", "molecule", "=", "shallowCopy;", "generateCoordinates(firstBondVector);", "double", "bondLength", "=", "GeometryTools.getBondLengthAverage(molecule);", "HydrogenPlacer", "hPlacer", "=", "new", "HydrogenPlacer();", "molecule", "=", "original;", "hPlacer.placeHydrogens2D(molecule,", "bondLength);", "}" ]
[ "<code>private", "String", "createBuildsStats(MemoryImprint", "memoryImprint,", "TaskListener", "listener,", "Map<String,", "String>", "parameters)", "{", "StringBuilder", "str", "=", "new", "StringBuilder(\"\");", "final", "String", "rootUrl", "=", "hudson.getRootUrl();", "String", "unsuccessfulMessage", "=", "null;", "Entry[]", "entries", "=", "memoryImprint.getEntries();", "if", "(entries.length", ">", "0)", "{", "str.append(\"\\n\");", "for", "(Entry", "entry", ":", "entries)", "{", "AbstractBuild", "build", "=", "entry.getBuild();", "if", "(build", "!=", "null)", "{", "GerritTrigger", "trigger", "=", "GerritTrigger.getTrigger(build.getProject());", "Result", "res", "=", "build.getResult();", "String", "customMessage", "=", "null;", "str.append(\"\\n\\n\");", "if", "(trigger.getCustomUrl()", "==", "null", "||", "trigger.getCustomUrl().isEmpty())", "{", "str.append(rootUrl).append(entry.getBuild().getUrl());", "}", "else", "{", "str.append(expandParameters(trigger.getCustomUrl(),", "build,", "listener,", "parameters));", "}", "str.append(MESSAGE_DELIMITER);", "if", "(res", "==", "Result.SUCCESS)", "{", "customMessage", "=", "trigger.getBuildSuccessfulMessage();", "}", "else", "if", "(res", "==", "Result.FAILURE", "||", "res", "==", "Result.ABORTED)", "{", "customMessage", "=", "trigger.getBuildFailureMessage();", "}", "else", "if", "(res", "==", "Result.UNSTABLE)", "{", "customMessage", "=", "trigger.getBuildUnstableMessage();", "}", "else", "{", "customMessage", "=", "trigger.getBuildFailureMessage();", "}", "if", "(customMessage", "==", "null", "||", "customMessage.equals(\"\"))", "{", "str.append(res.toString());", "}", "else", "{", "str.append(customMessage);", "}", "<START>", "if", "(res", "!=", "Result.SUCCESS)", "{", "<END>", "unsuccessfulMessage", "=", "entry.getUnsuccessfulMessage();", "if", "(null", "!=", "unsuccessfulMessage", "&&", "!unsuccessfulMessage.isEmpty())", "{", "logger.trace(\"Using", "unsuccessful", "message", "from", "file.\");", "str.append(\"", "<<<\\n\");", "str.append(unsuccessfulMessage.trim());", "str.append(\"\\n>>>", "\");", "}", "}", "}", "}", "}", "else", "{", "logger.error(\"I", "got", "a", "request", "to", "create", "build", "statistics,", "but", "no", "entries", "where", "found!\");", "}", "return", "str.toString();", "}</code><technical_language>res.isWorseThan(Result.SUCCESS)", "instead.", "<LINK_0></technical_language>" ]
[ "private", "String", "createBuildsStats(MemoryImprint", "memoryImprint,", "TaskListener", "listener,", "Map<String,", "String>", "parameters)", "{", "StringBuilder", "str", "=", "new", "StringBuilder(\"\");", "final", "String", "rootUrl", "=", "hudson.getRootUrl();", "String", "unsuccessfulMessage", "=", "null;", "Entry[]", "entries", "=", "memoryImprint.getEntries();", "if", "(entries.length", ">", "0)", "{", "for", "(Entry", "entry", ":", "entries)", "{", "AbstractBuild", "build", "=", "entry.getBuild();", "if", "(build", "!=", "null)", "{", "GerritTrigger", "trigger", "=", "GerritTrigger.getTrigger(build.getProject());", "Result", "res", "=", "build.getResult();", "String", "customMessage", "=", "null;", "str.append(\"\\n\\n\");", "if", "(trigger.getCustomUrl()", "==", "null", "||", "trigger.getCustomUrl().isEmpty())", "{", "str.append(rootUrl).append(entry.getBuild().getUrl());", "}", "else", "{", "str.append(expandParameters(trigger.getCustomUrl(),", "build,", "listener,", "parameters));", "}", "str.append(MESSAGE_DELIMITER);", "if", "(res", "==", "Result.SUCCESS)", "{", "customMessage", "=", "trigger.getBuildSuccessfulMessage();", "}", "else", "if", "(res", "==", "Result.FAILURE", "||", "res", "==", "Result.ABORTED)", "{", "customMessage", "=", "trigger.getBuildFailureMessage();", "}", "else", "if", "(res", "==", "Result.UNSTABLE)", "{", "customMessage", "=", "trigger.getBuildUnstableMessage();", "}", "else", "{", "customMessage", "=", "trigger.getBuildFailureMessage();", "}", "if", "(customMessage", "==", "null", "||", "customMessage.equals(\"\"))", "{", "str.append(res.toString());", "}", "else", "{", "str.append(customMessage);", "}", "if", "(res.isWorseThan(Result.SUCCESS))", "{", "unsuccessfulMessage", "=", "entry.getUnsuccessfulMessage();", "if", "(null", "!=", "unsuccessfulMessage", "&&", "!unsuccessfulMessage.isEmpty())", "{", "logger.trace(\"Using", "unsuccessful", "message", "from", "file.\");", "str.append(\"", "<<<\\n\");", "str.append(unsuccessfulMessage.trim());", "str.append(\"\\n>>>\");", "}", "}", "}", "}", "}", "else", "{", "logger.error(\"I", "got", "a", "request", "to", "create", "build", "statistics,", "but", "no", "entries", "where", "found!\");", "}", "return", "str.toString();", "}" ]
[ "<code>public", "void", "visitNode(Tree", "tree)", "{", "if", "(tree.is(Kind.METHOD)", "&&", "isServletInit((MethodTree)", "tree))", "{", "tree.accept(new", "AssignmentVisitor());", "}", "else", "if", "(tree.is(Kind.VARIABLE))", "{", "VariableTree", "variable", "=", "(VariableTree)", "tree;", "<START>", "if", "(hasSemantic()", "&&", "isOwnedByAServlet(variable)", "&&", "!isStaticOrFinal(variable))", "{", "<END>", "issuableVariables.add(variable);", "}", "}", "}</code><technical_language>checking", "for", "semantic", "done", "checking", "type", "of", "tree,", "semantic", "is", "get", "parameter", "type", "of", "method</technical_language>" ]
[ "public", "void", "visitNode(Tree", "tree)", "{", "if", "(tree.is(Kind.METHOD)", "&&", "isServletInit((MethodTree)", "tree))", "{", "tree.accept(new", "AssignmentVisitor());", "}", "else", "if", "(tree.is(Kind.VARIABLE))", "{", "VariableTree", "variable", "=", "(VariableTree)", "tree;", "if", "(isOwnedByAServlet(variable)", "&&", "!isStaticOrFinal(variable))", "{", "issuableVariables.add(variable);", "}", "}", "}" ]
[ "<code>public", "void", "shouldNotExpireChargesWhenAwaitingCaptureDelayIsLessThan48Hours()", "{", "<START>", "String", "extChargeId1", "=", "addCharge(CREATED,", "\"ref\",", "ZonedDateTime.now().minusMinutes(90),", "RandomIdGenerator.newId());", "<END>", "String", "extChargeId2", "=", "addCharge(AWAITING_CAPTURE_REQUEST,", "\"ref\",", "ZonedDateTime.now().minusHours(48L).plusMinutes(1L),", "RandomIdGenerator.newId());", "worldpayMockClient.mockCancelSuccess();", "connectorRestApiClient", ".postChargeExpiryTask()", ".statusCode(OK.getStatusCode())", ".contentType(JSON)", ".body(\"expiry-success\",", "is(1))", ".body(\"expiry-failed\",", "is(0));", "connectorRestApiClient", ".withAccountId(accountId)", ".withChargeId(extChargeId1)", ".getCharge()", ".statusCode(OK.getStatusCode())", ".contentType(JSON)", ".body(JSON_CHARGE_KEY,", "is(extChargeId1))", ".body(JSON_STATE_KEY,", "is(EXPIRED.toExternal().getStatus()));", "connectorRestApiClient", ".withAccountId(accountId)", ".withChargeId(extChargeId2)", ".getCharge()", ".statusCode(OK.getStatusCode())", ".contentType(JSON)", ".body(JSON_CHARGE_KEY,", "is(extChargeId2))", ".body(JSON_STATE_KEY,", "is(AWAITING_CAPTURE_REQUEST.toExternal().getStatus()));", "List<String>", "events1", "=", "databaseTestHelper.getInternalEvents(extChargeId1);", "List<String>", "events2", "=", "databaseTestHelper.getInternalEvents(extChargeId2);", "assertTrue(isEqualCollection(events1,", "asList(CREATED.getValue(),", "EXPIRED.getValue())));", "assertTrue(isEqualCollection(events2,", "asList(AWAITING_CAPTURE_REQUEST.getValue())));", "}</code><technical_language>role", "this", "charge", "is", "playing", "in", "test</technical_language>" ]
[ "public", "void", "shouldNotExpireChargesWhenAwaitingCaptureDelayIsLessThan48Hours()", "{", "String", "chargeToBeExpiredCreatedStatus", "=", "addCharge(CREATED,", "\"ref\",", "ZonedDateTime.now().minusMinutes(90),", "RandomIdGenerator.newId());", "String", "chargeToBeExpiredAwaitingCaptureRequest", "=", "addCharge(AWAITING_CAPTURE_REQUEST,", "\"ref\",", "ZonedDateTime.now().minusHours(48L).plusMinutes(1L),", "RandomIdGenerator.newId());", "worldpayMockClient.mockCancelSuccess();", "connectorRestApiClient", ".postChargeExpiryTask()", ".statusCode(OK.getStatusCode())", ".contentType(JSON)", ".body(\"expiry-success\",", "is(1))", ".body(\"expiry-failed\",", "is(0));", "connectorRestApiClient", ".withAccountId(accountId)", ".withChargeId(chargeToBeExpiredCreatedStatus)", ".getCharge()", ".statusCode(OK.getStatusCode())", ".contentType(JSON)", ".body(JSON_CHARGE_KEY,", "is(chargeToBeExpiredCreatedStatus))", ".body(JSON_STATE_KEY,", "is(EXPIRED.toExternal().getStatus()));", "connectorRestApiClient", ".withAccountId(accountId)", ".withChargeId(chargeToBeExpiredAwaitingCaptureRequest)", ".getCharge()", ".statusCode(OK.getStatusCode())", ".contentType(JSON)", ".body(JSON_CHARGE_KEY,", "is(chargeToBeExpiredAwaitingCaptureRequest))", ".body(JSON_STATE_KEY,", "is(AWAITING_CAPTURE_REQUEST.toExternal().getStatus()));", "List<String>", "events1", "=", "databaseTestHelper.getInternalEvents(chargeToBeExpiredCreatedStatus);", "List<String>", "events2", "=", "databaseTestHelper.getInternalEvents(chargeToBeExpiredAwaitingCaptureRequest);", "assertTrue(isEqualCollection(events1,", "asList(CREATED.getValue(),", "EXPIRED.getValue())));", "assertTrue(isEqualCollection(events2,", "asList(AWAITING_CAPTURE_REQUEST.getValue())));", "}" ]
[ "<code>public", "void", "updateSource(TaskSource", "sourceUpdate)", "{", "checkLockNotHeld(\"Can", "not", "update", "sources", "while", "holding", "the", "driver", "lock\");", "<START>", "checkArgument(sourceOperator.isPresent()", "&&", "sourceOperator.get().getSourceId().equals(sourceUpdate.getPlanNodeId()));", "<END>", "pendingTaskSourceUpdates.updateAndGet(current", "->", "current", "==", "null", "?", "sourceUpdate", ":", "current.update(sourceUpdate));", "tryWithLock(()", "->", "TRUE);", "}</code><technical_language>Add", "a", "message", "checkArgument", "call</technical_language>" ]
[ "public", "void", "updateSource(TaskSource", "sourceUpdate)", "{", "checkState(initialized.get(),", "\"Driver", "is", "not", "initialized\");", "checkLockNotHeld(\"Can", "not", "update", "sources", "while", "holding", "the", "driver", "lock\");", "checkArgument(", "sourceOperator.isPresent()", "&&", "sourceOperator.get().getSourceId().equals(sourceUpdate.getPlanNodeId()),", "\"sourceUpdate", "is", "for", "a", "plan", "node", "that", "is", "different", "from", "this", "Driver's", "source", "node\");", "pendingTaskSourceUpdates.updateAndGet(current", "->", "current", "==", "null", "?", "sourceUpdate", ":", "current.update(sourceUpdate));", "tryWithLock(()", "->", "TRUE);", "}" ]
[ "<code>protected", "int", "persistHydrant(", "FireHydrant", "indexToPersist,", "DataSchema", "schema,", "Interval", "interval,", "Map<String,", "Object>", "metadataElems", ")", "{", "synchronized", "(indexToPersist)", "{", "if", "(indexToPersist.hasSwapped())", "{", "log.info(", "\"DataSource[%s],", "Interval[%s],", "Hydrant[%s]", "already", "swapped.", "Ignoring", "request", "to", "persist.\",", "schema.getDataSource(),", "interval,", "indexToPersist", ");", "return", "0;", "}", "log.info(", "\"DataSource[%s],", "Interval[%s],", "Metadata", "[%s]", "persisting", "Hydrant[%s]\",", "schema.getDataSource(),", "interval,", "metadataElems,", "indexToPersist", ");", "try", "{", "int", "numRows", "=", "indexToPersist.getIndex().size();", "<START>", "final", "IndexSpec", "indexSpec", "=", "config.getIndexSpec();", "<END>", "indexToPersist.getIndex().getMetadata().putAll(metadataElems);", "final", "File", "persistedFile", "=", "indexMerger.persist(", "indexToPersist.getIndex(),", "interval,", "new", "File(computePersistDir(schema,", "interval),", "String.valueOf(indexToPersist.getCount())),", "indexSpec,", "config.getSegmentWriteOutMediumFactory()", ");", "indexToPersist.swapSegment(", "new", "QueryableIndexSegment(indexIO.loadIndex(persistedFile),", "indexToPersist.getSegmentId())", ");", "return", "numRows;", "}", "catch", "(IOException", "e)", "{", "log.makeAlert(\"dataSource[%s]", "--", "incremental", "persist", "failed\",", "schema.getDataSource())", ".addData(\"interval\",", "interval)", ".addData(\"count\",", "indexToPersist.getCount())", ".emit();", "throw", "new", "RuntimeException(e);", "}", "}", "}</code><technical_language>Change", "belong", "this", "PR</technical_language>" ]
[ "protected", "int", "persistHydrant(", "FireHydrant", "indexToPersist,", "DataSchema", "schema,", "Interval", "interval,", "Map<String,", "Object>", "metadataElems", ")", "{", "synchronized", "(indexToPersist)", "{", "if", "(indexToPersist.hasSwapped())", "{", "log.info(", "\"DataSource[%s],", "Interval[%s],", "Hydrant[%s]", "already", "swapped.", "Ignoring", "request", "to", "persist.\",", "schema.getDataSource(),", "interval,", "indexToPersist", ");", "return", "0;", "}", "log.info(", "\"DataSource[%s],", "Interval[%s],", "Metadata", "[%s]", "persisting", "Hydrant[%s]\",", "schema.getDataSource(),", "interval,", "metadataElems,", "indexToPersist", ");", "try", "{", "int", "numRows", "=", "indexToPersist.getIndex().size();", "indexToPersist.getIndex().getMetadata().putAll(metadataElems);", "final", "File", "persistedFile", "=", "indexMerger.persist(", "indexToPersist.getIndex(),", "interval,", "new", "File(computePersistDir(schema,", "interval),", "String.valueOf(indexToPersist.getCount())),", "config.getIndexSpecForIntermediatePersists(),", "config.getSegmentWriteOutMediumFactory()", ");", "indexToPersist.swapSegment(", "new", "QueryableIndexSegment(indexIO.loadIndex(persistedFile),", "indexToPersist.getSegmentId())", ");", "return", "numRows;", "}", "catch", "(IOException", "e)", "{", "log.makeAlert(\"dataSource[%s]", "--", "incremental", "persist", "failed\",", "schema.getDataSource())", ".addData(\"interval\",", "interval)", ".addData(\"count\",", "indexToPersist.getCount())", ".emit();", "throw", "new", "RuntimeException(e);", "}", "}", "}" ]
[ "<code>private", "void", "doBuildProject(File", "projectLocation,", "IProgressMonitor", "monitor)", "throws", "CoreException", "{", "if", "(monitor.isCanceled())", "{", "return;", "}", "try", "{", "monitor.beginTask(Messages.MSBuild_BuildProjectTask,", "10);", "<START>", "String", "msBuild", "=", "getMSBuildPath();", "<END>", "if", "(msBuild", "!=", "null)", "{", "File", "csprojFile", "=", "WPProjectUtils.getCsrojFile(projectLocation);", "Assert.isNotNull(csprojFile);", "StringBuilder", "cmdString", "=", "new", "StringBuilder(msBuild);", "cmdString.append(\"", "\");", "if", "(isRelease())", "{", "cmdString.append(\"/p:Configuration=Release", "\");", "}", "cmdString.append(csprojFile.getAbsolutePath());", "ExternalProcessUtility", "processUtility", "=", "new", "ExternalProcessUtility();", "if", "(monitor.isCanceled())", "{", "return;", "}", "monitor.worked(1);", "TextDetectingStreamListener", "listener", "=", "new", "TextDetectingStreamListener(", "\"Build", "succeeded.\");", "processUtility.execSync(cmdString.toString(),", "projectLocation,", "listener,", "listener,", "monitor,", "null,", "getLaunchConfiguration());", "if", "(!listener.isTextDetected())", "{", "throw", "new", "CoreException(new", "Status(IStatus.ERROR,", "WPCore.PLUGIN_ID,", "Messages.MSBuild_MSBuildError));", "}", "}", "}", "finally", "{", "monitor.done();", "}", "}</code><technical_language>Needs", "quotes", "msbuild", "command</technical_language>" ]
[ "private", "void", "doBuildProject(File", "projectLocation,", "IProgressMonitor", "monitor)", "throws", "CoreException", "{", "if", "(monitor.isCanceled())", "{", "return;", "}", "try", "{", "monitor.beginTask(Messages.MSBuild_BuildProjectTask,", "10);", "String", "msBuild", "=", "getMSBuildPath();", "if", "(msBuild", "!=", "null)", "{", "File", "csprojFile", "=", "WPProjectUtils.getCsrojFile(projectLocation);", "Assert.isNotNull(csprojFile);", "StringBuilder", "cmdString", "=", "new", "StringBuilder(addQuotes(msBuild));", "cmdString.append(\"", "\");", "if", "(isRelease())", "{", "cmdString.append(\"/p:Configuration=Release", "\");", "}", "cmdString.append(addQuotes(csprojFile.getAbsolutePath()));", "ExternalProcessUtility", "processUtility", "=", "new", "ExternalProcessUtility();", "if", "(monitor.isCanceled())", "{", "return;", "}", "monitor.worked(1);", "TextDetectingStreamListener", "listener", "=", "new", "TextDetectingStreamListener(", "\"Build", "succeeded.\");", "processUtility.execSync(cmdString.toString(),", "projectLocation,", "listener,", "listener,", "monitor,", "null,", "getLaunchConfiguration());", "if", "(!listener.isTextDetected())", "{", "throw", "new", "CoreException(new", "Status(IStatus.ERROR,", "WPCore.PLUGIN_ID,", "Messages.MSBuild_MSBuildError));", "}", "}", "}", "finally", "{", "monitor.done();", "}", "}" ]
[ "<code>private", "void", "initializeServices()", "{", "<START>", "logger().debug(\"Initializing", "couchbase", "services", "on", "host:", "\"", "+", "enabledServices);", "<END>", "final", "String", "services", "=", "enabledServices.stream().map(s", "->", "{", "switch", "(s)", "{", "case", "KV:", "return", "\"kv\";", "case", "QUERY:", "return", "\"n1ql\";", "case", "INDEX:", "return", "\"index\";", "case", "SEARCH:", "return", "\"fts\";", "default:", "throw", "new", "IllegalStateException(\"Unknown", "service!\");", "}", "}).collect(Collectors.joining(\",\"));", "Response", "response", "=", "doHttpRequest(MGMT_PORT,", "\"/node/controller/setupServices\",", "\"POST\",", "new", "FormBody.Builder()", ".add(\"services\",", "services)", ".build(),", "false", ");", "checkSuccessfulResponse(response,", "\"Could", "not", "enable", "couchbase", "services\");", "}</code><technical_language>suggestion", "logger().debug(\"Initializing", "couchbase", "services", "host:", "{}\",", "enabledServices);</technical_language>" ]
[ "private", "void", "initializeServices()", "{", "logger().debug(\"Initializing", "couchbase", "services", "on", "host:", "{}\",", "enabledServices);", "final", "String", "services", "=", "enabledServices.stream().map(s", "->", "{", "switch", "(s)", "{", "case", "KV:", "return", "\"kv\";", "case", "QUERY:", "return", "\"n1ql\";", "case", "INDEX:", "return", "\"index\";", "case", "SEARCH:", "return", "\"fts\";", "default:", "throw", "new", "IllegalStateException(\"Unknown", "service!\");", "}", "}).collect(Collectors.joining(\",\"));", "Response", "response", "=", "doHttpRequest(MGMT_PORT,", "\"/node/controller/setupServices\",", "\"POST\",", "new", "FormBody.Builder()", ".add(\"services\",", "services)", ".build(),", "false", ");", "checkSuccessfulResponse(response,", "\"Could", "not", "enable", "couchbase", "services\");", "}" ]
[ "<code>public", "Mono<HttpResponse>", "process(HttpPipelineCallContext", "context,", "HttpPipelineNextPolicy", "next)", "{", "Optional<Object>", "customHttpHeadersObject", "=", "context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY);", "<START>", "if", "(customHttpHeadersObject.isPresent()", "&&", "customHttpHeadersObject.get()", "instanceof", "HttpHeaders)", "{", "HttpHeaders", "customHttpHeaders", "=", "(HttpHeaders)", "customHttpHeadersObject.get();", "<END>", "for", "(HttpHeader", "httpHeader", ":", "customHttpHeaders)", "{", "if", "(!Objects.isNull(httpHeader.getName())", "&&", "!Objects.isNull(httpHeader.getValue()))", "{", "context.getHttpRequest().getHeaders().put(httpHeader.getName(),", "httpHeader.getValue());", "}", "}", "}", "return", "next.process();", "}</code><technical_language>This", "replaced", "java", "context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY).ifPresent(headers", "->", "{", "//", "for", "loop", "headers", "});</technical_language>" ]
[ "public", "Mono<HttpResponse>", "process(HttpPipelineCallContext", "context,", "HttpPipelineNextPolicy", "next)", "{", "context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY).ifPresent(headers", "->", "{", "if", "(headers", "instanceof", "HttpHeaders)", "{", "HttpHeaders", "customHttpHeaders", "=", "(HttpHeaders)", "headers;", "for", "(HttpHeader", "httpHeader", ":", "customHttpHeaders)", "{", "if", "(!Objects.isNull(httpHeader.getName())", "&&", "!Objects.isNull(httpHeader.getValue()))", "{", "context.getHttpRequest().getHeaders().put(httpHeader.getName(),", "httpHeader.getValue());", "}", "}", "}", "});", "return", "next.process();", "}" ]
[ "<code>public", "ExpressionAnalysis(", "Map<NodeRef<Expression>,", "Type>", "expressionTypes,", "Map<NodeRef<Expression>,", "Type>", "expressionCoercions,", "Set<NodeRef<InPredicate>>", "subqueryInPredicates,", "Set<NodeRef<SubqueryExpression>>", "scalarSubqueries,", "Set<NodeRef<ExistsPredicate>>", "existsSubqueries,", "Map<NodeRef<Expression>,", "FieldId>", "columnReferences,", "Set<NodeRef<Expression>>", "typeOnlyCoercions,", "Set<NodeRef<QuantifiedComparisonExpression>>", "quantifiedComparisons,", "Map<NodeRef<Identifier>,", "LambdaArgumentDeclaration>", "lambdaArgumentReferences)", "{", "<START>", "this.expressionTypes", "=", "new", "LinkedHashMap<>(requireNonNull(expressionTypes,", "\"expressionTypes", "is", "null\"));", "<END>", "this.expressionCoercions", "=", "new", "LinkedHashMap<>(requireNonNull(expressionCoercions,", "\"expressionCoercions", "is", "null\"));", "this.typeOnlyCoercions", "=", "new", "LinkedHashSet<>(requireNonNull(typeOnlyCoercions,", "\"typeOnlyCoercions", "is", "null\"));", "this.columnReferences", "=", "new", "LinkedHashMap<>(requireNonNull(columnReferences,", "\"columnReferences", "is", "null\"));", "this.subqueryInPredicates", "=", "new", "LinkedHashSet<>(requireNonNull(subqueryInPredicates,", "\"subqueryInPredicates", "is", "null\"));", "this.scalarSubqueries", "=", "new", "LinkedHashSet<>(requireNonNull(scalarSubqueries,", "\"subqueryInPredicates", "is", "null\"));", "this.existsSubqueries", "=", "new", "LinkedHashSet<>(requireNonNull(existsSubqueries,", "\"existsSubqueries", "is", "null\"));", "this.quantifiedComparisons", "=", "new", "LinkedHashSet<>(requireNonNull(quantifiedComparisons,", "\"quantifiedComparisons", "is", "null\"));", "this.lambdaArgumentReferences", "=", "new", "LinkedHashMap<>(requireNonNull(lambdaArgumentReferences,", "\"lambdaArgumentReferences", "is", "null\"));", "}</code><technical_language>wrap", "unmodifiableSet", "in", "constructor", "return", "field", "reference", "get*", "methods</technical_language>" ]
[ "public", "ExpressionAnalysis(", "Map<NodeRef<Expression>,", "Type>", "expressionTypes,", "Map<NodeRef<Expression>,", "Type>", "expressionCoercions,", "Set<NodeRef<InPredicate>>", "subqueryInPredicates,", "Set<NodeRef<SubqueryExpression>>", "scalarSubqueries,", "Set<NodeRef<ExistsPredicate>>", "existsSubqueries,", "Map<NodeRef<Expression>,", "FieldId>", "columnReferences,", "Set<NodeRef<Expression>>", "typeOnlyCoercions,", "Set<NodeRef<QuantifiedComparisonExpression>>", "quantifiedComparisons,", "Map<NodeRef<Identifier>,", "LambdaArgumentDeclaration>", "lambdaArgumentReferences)", "{", "this.expressionTypes", "=", "ImmutableMap.copyOf(requireNonNull(expressionTypes,", "\"expressionTypes", "is", "null\"));", "this.expressionCoercions", "=", "ImmutableMap.copyOf(requireNonNull(expressionCoercions,", "\"expressionCoercions", "is", "null\"));", "this.typeOnlyCoercions", "=", "ImmutableSet.copyOf(requireNonNull(typeOnlyCoercions,", "\"typeOnlyCoercions", "is", "null\"));", "this.columnReferences", "=", "ImmutableMap.copyOf(requireNonNull(columnReferences,", "\"columnReferences", "is", "null\"));", "this.subqueryInPredicates", "=", "ImmutableSet.copyOf(requireNonNull(subqueryInPredicates,", "\"subqueryInPredicates", "is", "null\"));", "this.scalarSubqueries", "=", "ImmutableSet.copyOf(requireNonNull(scalarSubqueries,", "\"subqueryInPredicates", "is", "null\"));", "this.existsSubqueries", "=", "ImmutableSet.copyOf(requireNonNull(existsSubqueries,", "\"existsSubqueries", "is", "null\"));", "this.quantifiedComparisons", "=", "ImmutableSet.copyOf(requireNonNull(quantifiedComparisons,", "\"quantifiedComparisons", "is", "null\"));", "this.lambdaArgumentReferences", "=", "ImmutableMap.copyOf(requireNonNull(lambdaArgumentReferences,", "\"lambdaArgumentReferences", "is", "null\"));", "}" ]
[ "<code>public", "FreeStyleProject", "newInstance(Branch", "branch)", "{", "FreeStyleProject", "job", "=", "new", "FreeStyleProject(getOwner(),", "branch.getEncodedName());", "setBranch(job,", "branch);", "try", "{", "<START>", "job.setQuietPeriod(0);", "<END>", "}", "catch(IOException", "e)", "{", "e.printStackTrace();", "}", "return", "job;", "}</code><technical_language>For", "test", "stability", "maintain", "previous", "quiet", "period", "of", "0.", "live", "behavior", "change</technical_language>" ]
[ "public", "FreeStyleProject", "newInstance(Branch", "branch)", "{", "FreeStyleProject", "job", "=", "new", "FreeStyleProject(getOwner(),", "branch.getEncodedName());", "setBranch(job,", "branch);", "if", "(quietPeriodSeconds", ">=", "0)", "{", "try", "{", "job.setQuietPeriod(quietPeriodSeconds);", "}", "catch(IOException", "e)", "{", "e.printStackTrace();", "}", "}", "return", "job;", "}" ]
[ "<code>public", "void", "init(final", "GlusterVolumeGeoRepCreateModel", "model)", "{", "super.init(model);", "model.getPropertyChangedEvent().addListener(new", "IEventListener<PropertyChangedEventArgs>()", "{", "@Override", "public", "void", "eventRaised(Event<?", "extends", "PropertyChangedEventArgs>", "ev,", "Object", "sender,", "PropertyChangedEventArgs", "args)", "{", "if(args.propertyName.equalsIgnoreCase(\"RecommendationViolations\"))", "{", "getView().setSuggestedConfigViolations(model.getRecommendationViolations());", "}", "else", "if", "(args.propertyName.equalsIgnoreCase(\"QueryFailed\"))", "{", "getView().setFailureMessage(model.getQueryFailureMessage());", "}", "}", "});", "<START>", "model.getSlaveUserName().getEntityChangedEvent().addListener(new", "IEventListener<EventArgs>()", "{", "@Override", "public", "void", "eventRaised(Event<?", "extends", "EventArgs>", "ev,", "Object", "sender,", "EventArgs", "args)", "{", "String", "slaveUser", "=", "model.getSlaveUserName()", ".getEntity();", "getView().setUserGroupVisibility(slaveUser", "!=", "null", "&&", "!slaveUser", ".equalsIgnoreCase(ConstantsManager.getInstance().getConstants().rootUser()));", "}", "});", "<END>", "}</code><technical_language>do", "this", "in", "model", "userGroup", "is", "represented", "in", "model.", "getSlaveUserGroupName().setIsChangeable()", "ui-editor", "enable", "disable</technical_language>" ]
[ "public", "void", "init(final", "GlusterVolumeGeoRepCreateModel", "model)", "{", "super.init(model);", "model.getPropertyChangedEvent().addListener(new", "IEventListener<PropertyChangedEventArgs>()", "{", "@Override", "public", "void", "eventRaised(Event<?", "extends", "PropertyChangedEventArgs>", "ev,", "Object", "sender,", "PropertyChangedEventArgs", "args)", "{", "if(args.propertyName.equalsIgnoreCase(\"RecommendationViolations\"))", "{", "getView().setSuggestedConfigViolations(model.getRecommendationViolations());", "}", "else", "if", "(args.propertyName.equalsIgnoreCase(\"QueryFailed\"))", "{", "getView().setFailureMessage(model.getQueryFailureMessage());", "}", "}", "});", "}" ]
[ "<code>public", "Scheduler", "cleanupResponseUrlDataScheduler()", "throws", "SchedulerException", "{", "<START>", "return", "this.constructScheduler(ResponseDataCleanupJob.class,", "KEY_CLEANUP_JOB_THREAD_COUNT,", "<END>", "KEY_CLEANUP_JOB_CRON_EXPRESSION,", "this.getDatabaseUrl(),", "this.databaseUsername,", "this.databasePassword,", "this.databaseDriver);", "}</code><technical_language>guess", "is", "ResponseUrlDataCleanupJob.class", "in", "stead", "of", "ResponseDataCleanupJob.class</technical_language>" ]
[ "public", "Scheduler", "cleanupResponseUrlDataScheduler()", "throws", "SchedulerException", "{", "return", "this.constructScheduler(ResponseUrlDataCleanupJob.class,", "KEY_CLEANUP_JOB_THREAD_COUNT,", "KEY_CLEANUP_JOB_CRON_EXPRESSION,", "this.getDatabaseUrl(),", "this.databaseUsername,", "this.databasePassword,", "this.databaseDriver);", "}" ]
[ "<code>public", "void", "generateType(final", "Ds3Type", "typeEntry)", "throws", "IOException", "{", "final", "Template", "typeTemplate", "=", "config.getTemplate(\"TypeEnumConstant.tmplt\");", "final", "Type", "type", "=", "TypeConverter.toType(typeEntry);", "final", "Path", "outputPath", "=", "getTypeOutputPath(type);", "final", "OutputStream", "outStream", "=", "fileUtils.getOutputFile(outputPath);", "final", "Writer", "writer", "=", "new", "OutputStreamWriter(outStream);", "try", "{", "typeTemplate.process(type,", "writer);", "}", "catch", "(final", "NullPointerException", "e)", "{", "LOG.error(\"Encountered", "NullPointerException", "while", "processing", "template", "\"", "+", "typeTemplate.getName(),", "e);", "<START>", "e.printStackTrace();", "<END>", "}", "catch", "(final", "TemplateException", "e)", "{", "LOG.error(\"Encountered", "TemplateException", "while", "processing", "template", "\"", "+", "typeTemplate.getName(),", "e);", "e.printStackTrace();", "}", "}</code><technical_language>appending", "exception", "in", "logging", "statement,", "do", "print", "stack", "trace.", "This", "result", "in", "stack", "printing", "twice,", "depending", "logger", "is", "configured</technical_language>" ]
[ "public", "void", "generateType(final", "Ds3Type", "typeEntry)", "throws", "IOException", "{", "final", "Template", "typeTemplate", "=", "config.getTemplate(\"TypeEnumConstant.tmplt\");", "final", "Type", "type", "=", "TypeConverter.toType(typeEntry);", "final", "Path", "outputPath", "=", "getTypeOutputPath(type);", "final", "OutputStream", "outStream", "=", "fileUtils.getOutputFile(outputPath);", "final", "Writer", "writer", "=", "new", "OutputStreamWriter(outStream);", "try", "{", "typeTemplate.process(type,", "writer);", "}", "catch", "(final", "NullPointerException", "e)", "{", "LOG.error(\"Encountered", "NullPointerException", "while", "processing", "template", "\"", "+", "typeTemplate.getName(),", "e);", "}", "catch", "(final", "TemplateException", "e)", "{", "LOG.error(\"Encountered", "TemplateException", "while", "processing", "template", "\"", "+", "typeTemplate.getName(),", "e);", "}", "}" ]
[ "<code>private", "Map<Long,", "ISegmentAspect>", "getAspectsFromColumnsId(List<Long>", "desiredColumns)", "{", "Map<Long,", "ISegmentAspect>", "aspects", "=", "new", "LinkedHashMap<>();", "if", "<START>", "(!desiredColumns.isEmpty())", "<END>", "{", "for", "(Long", "columnsId", ":", "desiredColumns)", "{", "ISegmentAspect", "segmentAspect", "=", "fAspectMap.get(columnsId);", "if", "(segmentAspect", "!=", "null)", "{", "aspects.put(columnsId,", "segmentAspect);", "}", "}", "return", "aspects;", "}", "return", "fAspectMap;", "}</code><technical_language>return", "instantiating", "map</technical_language>" ]
[ "private", "Map<Long,", "ISegmentAspect>", "getAspectsFromColumnsId(List<Long>", "desiredColumns)", "{", "if", "(!desiredColumns.isEmpty())", "{", "Map<Long,", "ISegmentAspect>", "aspects", "=", "new", "LinkedHashMap<>();", "for", "(Long", "columnsId", ":", "desiredColumns)", "{", "ISegmentAspect", "segmentAspect", "=", "fAspectMap.get(columnsId);", "if", "(segmentAspect", "!=", "null)", "{", "aspects.put(columnsId,", "segmentAspect);", "}", "}", "return", "aspects;", "}", "return", "fAspectMap;", "}" ]
[ "<code>public", "String", "toString()", "{", "<START>", "return", "\"KubernetesCloud", "'\"", "+", "name", "+", "\"'", "serverUrl", ":\"", "+", "serverUrl;", "<END>", "}</code><technical_language>more", "of", "a", "personal", "taste", "question,", "Guava", "MoreObjects</technical_language>" ]
[ "public", "String", "toString()", "{", "return", "MoreObjects.toStringHelper(this).add(\"name\",", "name).add(\"serverUrl\",", "serverUrl).toString();", "}" ]
[ "<code>public", "int", "getOptimalTileWidth()", "{", "FormatTools.assertId(currentId,", "true,", "1);", "RandomAccessInputStream", "plane", "=", "getPlane(getSeries(),", "0);", "if", "(plane", "==", "null)", "return", "super.getOptimalTileWidth();", "try", "{", "TiffParser", "tp", "=", "new", "TiffParser(plane);", "IFD", "ifd", "=", "tp.getFirstIFD();", "return", "(int)", "ifd.getTileWidth();", "}", "catch", "(FormatException", "e)", "{", "LOGGER.debug(\"Could", "not", "retrieve", "tile", "width\",", "e);", "}", "catch", "(IOException", "e)", "{", "LOGGER.debug(\"Could", "not", "retrieve", "tile", "width\",", "e);", "<START>", "}", "finally", "{", "<END>", "try", "{", "plane.close();", "}", "catch", "(IOException", "e2)", "{", "LOGGER.debug(\"Could", "not", "close", "stream\",", "e2);", "}", "}", "return", "super.getOptimalTileWidth();", "}</code><technical_language>RAIS", "plane2", "=", "plane", "here,", "e.g.:", "import", "java.io.Closeable;", "class", "C", "implements", "Closeable", "{", "public", "void", "close()", "{", "System.out.println(\"closed\");", "}", "}", "public", "class", "M", "{", "public", "static", "void", "main(String[]", "args)", "{", "C", "c", "=", "new", "C();", "try", "(C", "c2", "=", "c)", "{", "System.out.println(\"done\");", "}", "}", "}</technical_language>" ]
[ "public", "int", "getOptimalTileWidth()", "{", "FormatTools.assertId(currentId,", "true,", "1);", "RandomAccessInputStream", "plane", "=", "getPlane(getSeries(),", "0);", "if", "(plane", "==", "null)", "return", "super.getOptimalTileWidth();", "try", "(RandomAccessInputStream", "p", "=", "plane)", "{", "TiffParser", "tp", "=", "new", "TiffParser(plane);", "IFD", "ifd", "=", "tp.getFirstIFD();", "return", "(int)", "ifd.getTileWidth();", "}", "catch", "(FormatException", "e)", "{", "LOGGER.debug(\"Could", "not", "retrieve", "tile", "width\",", "e);", "}", "catch", "(IOException", "e)", "{", "LOGGER.debug(\"Could", "not", "retrieve", "tile", "width\",", "e);", "}", "return", "super.getOptimalTileWidth();", "}" ]
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
1