auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void split(TableName tableName) throws IOException, InterruptedException { <START> <END> }</code><technical_language>I assume longer throwing UnsupportedExceptions split is want hide (e.g., users worry a no-op)</technical_language>

Target:
public void split(TableName tableName) throws IOException, InterruptedException { throw new UnsupportedOperationException("split"); }
Source:
<code>public static ExceptionThrowingSubTest expectThrowable(String description, Runnable runnable) { return expectException( description, () -> { runnable.run(); return null; } <START> ); <END> }</code><technical_language>expectException(String, Runnable), do need it</technical_language>

Target:
public static ExceptionThrowingSubTest expectThrowable(String description, Runnable runnable) { return expectThrowable( description, () -> { runnable.run(); return null; } ); }
Source:
<code>private static byte[] computeIndexTreeLookupId(ObjectId indexId, @Nullable ObjectId treeId) { <START> return (indexId.toString() + "." + (treeId == null ? "" : treeId.toString())) <END> .getBytes(Charsets.UTF_8); }</code><technical_language>if this is hit often, String concatenation slow opposed a StringBuilder. Also, append/concatenate empty string "" if treeId is null? do this: java StringBuilder sb = new StringBuilder(indexId.toString()).append("."); if (treeId != null) { sb.append(treeId.toString()); } return sb.toString().getBytes(Charsets.UTF_8);</technical_language>

Target:
private static byte[] computeIndexTreeLookupId(ObjectId indexId, @Nullable ObjectId treeId) { StringBuilder sb = new StringBuilder(indexId.toString()).append("."); if (treeId != null) { sb.append(treeId.toString()); } return sb.toString().getBytes(Charsets.UTF_8); }
Source:
<code>public void onMwSuccess() { if (isSlatedForRestBase()) { <START> int successes = Prefs.getRequestSuccessCounter(0); <END> Prefs.setRequestSuccessCounter(++successes); resetFailed(); if (successes >= SUCCESS_THRESHOLD && !Prefs.useRestBaseSetManually()) { Prefs.setUseRestBase(true); } } }</code><technical_language>feels zero embedded in Prefs default value</technical_language>

Target:
public void onMwSuccess() { if (isSlatedForRestBase()) { int successes = Prefs.getRequestSuccessCounter(0); successes++; Prefs.setRequestSuccessCounter(successes); resetFailed(); if (successes >= SUCCESS_THRESHOLD && !Prefs.useRestBaseSetManually()) { Prefs.setUseRestBase(true); } } }
Source:
<code>PatchSetSelectBox2(DiffTable table, final DisplaySide side, final Change.Id changeId, final PatchSet.Id revision, String path) { initWidget(uiBinder.createAndBindUi(this)); icon.setTitle(PatchUtil.C.addFileCommentToolTip()); icon.addStyleName(Gerrit.RESOURCES.css().link()); this.table = table; this.side = side; this.sideA = side == DisplaySide.A; this.changeId = changeId; this.revision = revision; this.idActive = (sideA && revision == null) ? null : revision; this.path = path; <START> setTitle(PatchUtil.C.addFileCommentByDoubleClick()); addDomHandler(new DoubleClickHandler() { <END> @Override public void onDoubleClick(DoubleClickEvent event) { onIconClick(null); } }, DoubleClickEvent.getType()); }</code><technical_language>I in earlier revision, double click sense header more widgets accept single click? I does</technical_language>

Target:
PatchSetSelectBox2(DiffTable table, final DisplaySide side, final Change.Id changeId, final PatchSet.Id revision, String path) { initWidget(uiBinder.createAndBindUi(this)); icon.setTitle(PatchUtil.C.addFileCommentToolTip()); icon.addStyleName(Gerrit.RESOURCES.css().link()); this.table = table; this.side = side; this.sideA = side == DisplaySide.A; this.changeId = changeId; this.revision = revision; this.idActive = (sideA && revision == null) ? null : revision; this.path = path; setTitle(PatchUtil.C.addFileCommentToolTip()); addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onIconClick(null); } }, ClickEvent.getType()); }
Source:
<code>public State traverse(State s0) { final RoutingRequest options = s0.getOptions(); final TraverseMode currMode = s0.getNonTransitMode(); <START> if (options.excludeWalking && currMode.equals(TraverseMode.WALK)) { <END> return null; } StateEditor editor = doTraverse(s0, options, s0.getNonTransitMode()); State state = (editor == null) ? null : editor.makeState(); if (options.kissAndRide) { if (options.arriveBy) { if (s0.isCarParked() && s0.isEverBoarded() && currMode == TraverseMode.WALK) { editor = doTraverse(s0, options, TraverseMode.CAR); if (editor != null) { editor.setCarParked(false); State forkState = editor.makeState(); if (forkState != null) { forkState.addToExistingResultChain(state); return forkState; } } } } else { if ( ! s0.isCarParked() && ! getPermission().allows(TraverseMode.CAR) && currMode == TraverseMode.CAR) { editor = doTraverse(s0, options, TraverseMode.WALK); if (editor != null) { editor.setCarParked(true); return editor.makeState(); } } } } return state; }</code><technical_language>circumstances is this triggered? want prevent walking, occurs starting point transit stops? I suppose this is in conjunction dynamically inserted flex/deviated stops, some distance a starting point slightly a pickup area</technical_language>

Target:
public State traverse(State s0) { final RoutingRequest options = s0.getOptions(); final TraverseMode currMode = s0.getNonTransitMode(); StateEditor editor = doTraverse(s0, options, s0.getNonTransitMode()); State state = (editor == null) ? null : editor.makeState(); if (options.kissAndRide) { if (options.arriveBy) { if (s0.isCarParked() && s0.isEverBoarded() && currMode == TraverseMode.WALK) { editor = doTraverse(s0, options, TraverseMode.CAR); if (editor != null) { editor.setCarParked(false); State forkState = editor.makeState(); if (forkState != null) { forkState.addToExistingResultChain(state); return forkState; } } } } else { if ( ! s0.isCarParked() && ! getPermission().allows(TraverseMode.CAR) && currMode == TraverseMode.CAR) { editor = doTraverse(s0, options, TraverseMode.WALK); if (editor != null) { editor.setCarParked(true); return editor.makeState(); } } } } return state; }
Source:
<code>public IamAdminServicesHandler() { try { GenericObjectPool.Config poolConfig = new GenericObjectPool.Config(); poolConfig.maxActive = 100; poolConfig.minIdle = 5; poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; poolConfig.testOnBorrow = true; poolConfig.testWhileIdle = true; poolConfig.numTestsPerEvictionRun = 10; poolConfig.maxWait = 3000; csClientPool = new ThriftClientPool<>( tProtocol -> new CredentialStoreService.Client(tProtocol), poolConfig, ServerSettings.getCredentialStoreServerHost(), Integer.parseInt(ServerSettings.getCredentialStoreServerPort())); registryClientPool = new ThriftClientPool<>( tProtocol -> new RegistryService.Client(tProtocol), poolConfig, ServerSettings.getRegistryServerHost(), Integer.parseInt(ServerSettings.getRegistryServerPort())); <START> }catch (ApplicationSettingsException e) { <END> logger.error("Error occured while reading airavata-server properties..", e); } }</code><technical_language>space }</technical_language>

Target:
public IamAdminServicesHandler() throws Exception { try { GenericObjectPool.Config poolConfig = new GenericObjectPool.Config(); poolConfig.maxActive = 100; poolConfig.minIdle = 5; poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; poolConfig.testOnBorrow = true; poolConfig.testWhileIdle = true; poolConfig.numTestsPerEvictionRun = 10; poolConfig.maxWait = 3000; csClientPool = new ThriftClientPool<>( tProtocol -> new CredentialStoreService.Client(tProtocol), poolConfig, ServerSettings.getCredentialStoreServerHost(), Integer.parseInt(ServerSettings.getCredentialStoreServerPort())); registryClientPool = new ThriftClientPool<>( tProtocol -> new RegistryService.Client(tProtocol), poolConfig, ServerSettings.getRegistryServerHost(), Integer.parseInt(ServerSettings.getRegistryServerPort())); } catch (ApplicationSettingsException e) { logger.error("Error occured while reading airavata-server properties..", e); throw new Exception(e); } }
Source:
<code>public void scanFile(JavaFileScannerContext context) { this.context = context; classVisitor = new CheckClassVisitor(); <START> context.getTree().accept(classVisitor); <END> scan(context.getTree()); }</code><technical_language>override visitClass() method</technical_language>

Target:
public void scanFile(JavaFileScannerContext context) { this.context = context; scan(context.getTree()); }
Source:
<code>static ExternalMessageType fromId(ChannelId channelId) { checkNotNull(channelId); final StringValue rawValue = AnyPacker.unpack(channelId.getIdentifier()); final TypeUrl typeUrl = TypeUrl.parse(rawValue.getValue()); final boolean isRejection = Rejections.isRejection(typeUrl.getJavaClass()); <START> final String wrapperTypeUrl = isRejection ? TypeUrl.of(Rejection.class).value() <END> : TypeUrl.of(Event.class).value(); final ExternalMessageType result = ExternalMessageType.newBuilder() .setMessageTypeUrl(typeUrl.value()) .setWrapperTypeUrl(wrapperTypeUrl) .build(); return result; }</code><technical_language>type URLs for Rejection Event constants</technical_language>

Target:
static ExternalMessageType fromId(ChannelId channelId) { checkNotNull(channelId); final StringValue rawValue = AnyPacker.unpack(channelId.getIdentifier()); final TypeUrl typeUrl = TypeUrl.parse(rawValue.getValue()); final boolean isRejection = Rejections.isRejection(typeUrl.getJavaClass()); final String wrapperTypeUrl = isRejection ? REJECTION_TYPE_URL.value() : EVENT_TYPE_URL.value(); final ExternalMessageType result = ExternalMessageType.newBuilder() .setMessageTypeUrl(typeUrl.value()) .setWrapperTypeUrl(wrapperTypeUrl) .build(); return result; }
Source:
<code>public BigInteger getBigInteger(String key) { String value = getRawString(key); if (value == null) return notFound(); try { <START> return BigInteger.valueOf(Long.valueOf(value)); <END> } catch (NumberFormatException e) { return parseError(key, value, e); } }</code><technical_language>related specific change in this PR, this do like: java return new BigInteger(value); fit a Long</technical_language>

Target:
public BigInteger getBigInteger(String key) { String value = interpolate(key); if (value == null) return notFound(); try { return new BigInteger(value); } catch (NumberFormatException e) { return parseError(key, value, e); } }
Source:
<code>public Subject createSubject(final String x509Name, final PublicKey publicKey) throws SAMLComponentBuilderException { Subject subject = null; try { final SubjectBean subjectBean = new SubjectBean(); subject = SAML2ComponentBuilder.createSaml2Subject(subjectBean); subject.setNameID(createNameID(X509_NAME_ID, x509Name)); subject.getSubjectConfirmations().remove(0); final SubjectConfirmationData subjectConfirmationData = createSubjectConfirmationData(publicKey); final SubjectConfirmation subjectConfirmation = createHoKConfirmation(subjectConfirmationData); subject.getSubjectConfirmations().add(subjectConfirmation); } catch (org.opensaml.security.SecurityException | org.apache.wss4j.common.ext.WSSecurityException e) { <START> LOG.error("Unable to create Saml2Subject ", e.getLocalizedMessage()); <END> throw new SAMLComponentBuilderException(e.getLocalizedMessage(), e); } return subject; }</code><technical_language>Log.error ("something {}",e.getLocalizedMessage());</technical_language>

Target:
public Subject createSubject(final String x509Name, final PublicKey publicKey) throws SAMLComponentBuilderException { Subject subject = null; try { final SubjectBean subjectBean = new SubjectBean(); subject = SAML2ComponentBuilder.createSaml2Subject(subjectBean); subject.setNameID(createNameID(X509_NAME_ID, x509Name)); subject.getSubjectConfirmations().remove(0); final SubjectConfirmationData subjectConfirmationData = createSubjectConfirmationData(publicKey); final SubjectConfirmation subjectConfirmation = createHoKConfirmation(subjectConfirmationData); subject.getSubjectConfirmations().add(subjectConfirmation); } catch (SecurityException | WSSecurityException e) { LOG.error("Unable to create Saml2Subject ", e.getLocalizedMessage()); throw new SAMLComponentBuilderException(e.getLocalizedMessage(), e); } return subject; }
Source:
<code>public void handleTaskLevelCheckpointException( CheckpointException exception, long checkpointId, ExecutionAttemptID executionAttemptID) { <START> handleException(exception, of(checkpointId), (failureCallback, e) -> failureCallback.failJobDueToTaskFailure(e, executionAttemptID)); <END> }</code><technical_language>I refrain static imports. problem I is another person needs this belongs Optional this code</technical_language>

Target:
public void handleTaskLevelCheckpointException( CheckpointException exception, long checkpointId, ExecutionAttemptID executionAttemptID) { checkFailureCounter(exception, checkpointId); if (continuousFailureCounter.get() > tolerableCpFailureNumber) { clearCount(); failureCallback.failJobDueToTaskFailure(new FlinkRuntimeException("Exceeded checkpoint tolerable failure threshold."), executionAttemptID); } }
Source:
<code>public static List<Patch> NopolPatchGeneration(String cpClassFolder,String cpTestFolder, String srcClassFolder, String srcTestFolder, String destSrcTestFolder, String destCpTestFolder, String dependencies, String[] testClasses) { String sources = srcClassFolder+File.pathSeparatorChar+srcTestFolder+File.pathSeparatorChar+destSrcTestFolder; String cp = cpClassFolder+File.pathSeparatorChar+cpTestFolder+File.pathSeparatorChar+destCpTestFolder+File.pathSeparatorChar+dependencies; String[] sourcesArray = sources.split(File.pathSeparator); File[] sourceFiles = new File[sourcesArray.length]; for(int i = 0; i<sourcesArray.length; i++){ sourceFiles[i] = FileLibrary.openFrom(sourcesArray[i]); } URL[] classPath = JavaLibrary.classpathFrom(cp); logger.debug("Launch nopol with:"); logger.debug("sources = "+sources); <START> logger.debug("getClasspath = "+cp); <END> logger.debug("getTestClasses = "+testClasses); Config config = new Config(sourceFiles, classPath, testClasses); config.setMaxTimeInMinutes(maxTime); config.setType(nopolType); NoPol nopol = new NoPol(config); List<Patch> currentPatches; currentPatches = nopol.build(); return currentPatches; }</code><technical_language>change lines</technical_language>

Target:
public static List<Patch> NopolPatchGeneration(String cpClassFolder,String cpTestFolder, String srcClassFolder, String srcTestFolder, String destSrcTestFolder, String destCpTestFolder, String dependencies, String[] testClasses) { String sources = srcClassFolder+File.pathSeparatorChar+srcTestFolder+File.pathSeparatorChar+destSrcTestFolder; String cp = cpClassFolder+File.pathSeparatorChar+cpTestFolder+File.pathSeparatorChar+destCpTestFolder+File.pathSeparatorChar+dependencies; String[] sourcesArray = sources.split(File.pathSeparator); File[] sourceFiles = new File[sourcesArray.length]; for(int i = 0; i<sourcesArray.length; i++){ sourceFiles[i] = FileLibrary.openFrom(sourcesArray[i]); } URL[] classPath = JavaLibrary.classpathFrom(cp); logger.debug("Launch nopol with:"); logger.debug("sources = "+sources); logger.debug("classpath = "+cp); logger.debug("testClasses = "+testClasses); NopolContext nopolContext = new NopolContext(sourceFiles, classPath, testClasses); nopolContext.setMaxTimeInMinutes(maxTime); nopolContext.setType(nopolType); NoPol nopol = new NoPol(nopolContext); List<Patch> currentPatches; currentPatches = nopol.build(); return currentPatches; }
Source:
<code>public SchedulerTask<?> createTaskInstance( String taskType ) throws IllegalArgumentException <START> { <END> try { return lookupTask( taskType ); } catch ( ComponentLookupException e ) { this.logger.debug( "Failed to load Schedule Task: " + taskType, e ); throw new IllegalArgumentException( "Could not create task of type" + taskType, e ); } }</code><technical_language>afacit vvv is noise</technical_language>

Target:
public SchedulerTask<?> createTaskInstance( String taskType ) throws IllegalArgumentException { try { return lookupTask( taskType ); } catch ( ComponentLookupException e ) { throw new IllegalArgumentException( "Could not create task of type" + taskType, e ); } }
Source:
<code>public int getVisitsByPartOfDay(PartOfDay partOfDay) { int count = 0; for (ExplorationStatisticsEntry location : distinctLocations.values()) { <START> if (PartOfDay.getCorrespondingConstant(location.getDiscoveredDate()).getName().getSingular().equalsIgnoreCase( <END> partOfDay.getName().getSingular())) { count++; } } return count; }</code><technical_language>above, try simplify this adding meaningful local variables</technical_language>

Target:
public int getVisitsByPartOfDay(PartOfDay partOfDay) { int count = 0; for (ExplorationStatisticsEntry location : distinctLocations.values()) { PartOfDay day = PartOfDay.getCorrespondingConstant(location.getDiscoveredDate()); String locationName = day.getName().getSingular(); if (locationName.equalsIgnoreCase(partOfDay.getName().getSingular())) { count++; } } return count; }
Source:
<code>public void testGetTableDescriptorsByTableNameWithNullAndEmptyList() throws IOException { try (Admin admin = getConnection().getAdmin()) { Exception actualError = null; try { HTableDescriptor[] descriptor = admin.getTableDescriptorsByTableName(null); assertTrue(descriptor.length > 0); } catch (Exception e) { actualError = e; } <START> assertNull(actualError); <END> try { HTableDescriptor[] descriptor = admin.getTableDescriptorsByTableName(ImmutableList.<TableName>of()); assertTrue(descriptor.length > 0); } catch (Exception e) { actualError = e; } assertNull(actualError); } }</code><technical_language>please remove try</technical_language>

Target:
public void testGetTableDescriptorsByTableNameWithNullAndEmptyList() throws IOException { try (Admin admin = getConnection().getAdmin()) { assertTrue(admin.getTableDescriptorsByTableName(null).length > 0); assertTrue(admin.getTableDescriptorsByTableName(ImmutableList.<TableName>of()).length > 0); } }
Source:
<code>PkgControl(final PkgControl parent, final String subPkg, final boolean regex) { this.parent = parent; if (regex || parent.regex) { final String parentRegex = ensureRegex(parent.fullPackage, parent.regex); <START> final String thisRegex = addGroupingIfNecessary(ensureRegex(subPkg, regex), regex); <END> fullPackage = parentRegex + DOT_REGEX + thisRegex; patternForPartialMatch = createPatternForPartialMatch(); patternForExactMatch = createPatternForExactMatch(); this.regex = true; } else { fullPackage = parent.fullPackage + DOT + subPkg; patternForPartialMatch = null; patternForExactMatch = null; this.regex = false; } parent.children.add(this); }</code><technical_language>I do grouping sense, please explain</technical_language>

Target:
PkgControl(final PkgControl parent, final String subPkg, final boolean regex) { this.parent = parent; if (regex || parent.regex) { final String parentRegex = ensureSelfContainedRegex(parent.fullPackage, parent.regex); final String thisRegex = ensureSelfContainedRegex(subPkg, regex); fullPackage = parentRegex + DOT_REGEX + thisRegex; patternForPartialMatch = createPatternForPartialMatch(fullPackage); patternForExactMatch = createPatternForExactMatch(fullPackage); this.regex = true; } else { fullPackage = parent.fullPackage + DOT + subPkg; patternForPartialMatch = null; patternForExactMatch = null; this.regex = false; } parent.children.add(this); }
Source:
<code>public void testPullMultiLanguage() throws Exception { final long languageId = 2; final ContentType contentType = contentTypeAPI.search(" velocity_var_name = 'News'").get(0); final ContentletDataGen contentletDataGen = new ContentletDataGen(contentType.inode()).host(defaultHost).languageId(languageId); contentletDataGen.setProperty("title", "El Titulo"); contentletDataGen.setProperty("byline", "El Sub Titulo"); contentletDataGen.setProperty("story", "EL Relato"); contentletDataGen.setProperty("sysPublishDate", new Date()); contentletDataGen.setProperty("urlTitle", "/news/el-titulo"); final Contentlet contentlet = contentletDataGen.nextPersisted(); final ContentTool contentTool = getContentTool(languageId); try { <START> Thread.sleep(2000); <END> Assert.assertTrue( contentletAPI.isInodeIndexed(contentlet.getInode()) ); final List<ContentMap> results = contentTool.pull( "+structurename:news +(conhost:"+defaultHost.getIdentifier()+" conhost:system_host) +working:true", 6, "score News.sysPublishDate desc" ); Assert.assertFalse(results.isEmpty()); for(ContentMap cm : results) { Assert.assertEquals(cm.getContentObject().getLanguageId(), languageId); } } finally { contentletDataGen.remove(contentlet); } }</code><technical_language>I this is old, need this anymore. Replace indexPolicy</technical_language>

Target:
public void testPullMultiLanguage() throws Exception { final long languageId = 2; final ContentType contentType = contentTypeAPI.search(" velocity_var_name = 'News'").get(0); final ContentletDataGen contentletDataGen = new ContentletDataGen(contentType.inode()).host(defaultHost).languageId(languageId); contentletDataGen.setProperty("title", "El Titulo"); contentletDataGen.setProperty("byline", "El Sub Titulo"); contentletDataGen.setProperty("story", "EL Relato"); contentletDataGen.setProperty("sysPublishDate", new Date()); contentletDataGen.setProperty("urlTitle", "/news/el-titulo"); final Contentlet contentlet = contentletDataGen.nextPersisted(); final ContentTool contentTool = getContentTool(languageId); try { final List<ContentMap> results = contentTool.pull( "+structurename:news +(conhost:"+defaultHost.getIdentifier()+" conhost:system_host) +working:true", 6, "score News.sysPublishDate desc" ); Assert.assertFalse(results.isEmpty()); for(ContentMap cm : results) { Assert.assertEquals(cm.getContentObject().getLanguageId(), languageId); } } finally { contentletDataGen.remove(contentlet); } }
Source:
<code>private void doClose(Handler<AsyncResult<Void>> handler) { ContextImpl handlerContext = vertx.getOrCreateContext(); <START> context.executeBlocking((Future<Void> res) -> { <END> try { ch.close(); res.complete(null); } catch (IOException e) { res.fail(e); } }, ar -> { if (handler != null) { handlerContext.runOnContext(v -> handler.handle(ar)); } }); }</code><technical_language>execute handlerContext pass handler resultHandler of executeBlocking</technical_language>

Target:
private void doClose(Handler<AsyncResult<Void>> handler) { ContextImpl handlerContext = vertx.getOrCreateContext(); handlerContext.executeBlocking(res -> { try { ch.close(); res.complete(null); } catch (IOException e) { res.fail(e); } }, handler); }
Source:
<code>public ScriptedCollectionSetBuilder(File script, BundleContext bundleContext) throws IOException, ScriptException { if (!script.canRead()) { throw new IllegalStateException("Cannot read script at '" + script + "'."); } final String ext = Files.getFileExtension(script.getAbsolutePath()); ScriptEngineManager manager; if (bundleContext != null) { manager = new OSGiScriptEngineManager(bundleContext); } else { manager = new ScriptEngineManager(); <START> } <END> final ScriptEngine engine = manager.getEngineByExtension(ext); if (engine == null) { throw new IllegalStateException("No engine found for extension: " + ext); } if (!(engine instanceof Compilable)) { throw new IllegalStateException("Only engines that can compile scripts are supported."); } final Compilable compilable = (Compilable) engine; try (FileReader reader = new FileReader(script)) { compiledScript = compilable.compile(reader); } }</code><technical_language>move this code constructor like: java public ScriptedcollectionSetBuilder(File script) { this(script, new ScriptEngineManager()) } public ScriptedCollectionSetBuilder(File script, BundleContext context) { this(script, new OSGiScriptEngineManager(context); } private ScriptCollectionSetBuilder(File script, ScriptEngineManager manager) { ... }</technical_language>

Target:
public ScriptedCollectionSetBuilder(File script, BundleContext bundleContext) throws IOException, ScriptException { this(script, new OSGiScriptEngineManager(bundleContext)); }
Source:
<code>public boolean supports(final Credential credential) { return (DuoCredential.class.isAssignableFrom(credential.getClass()) || credential instanceof DuoDirectCredential) <START> && supports((MfaCredential) credential); <END> }</code><technical_language>Is supports((MfaCredential) credential); a recursive call overflow issue</technical_language>

Target:
public boolean supports(final Credential credential) { return (DuoCredential.class.isAssignableFrom(credential.getClass()) || credential instanceof DuoDirectCredential) && supports((MultiInstanceMfaCredential) credential); }
Source:
<code><START> public IInlinedAnnotationAction getAction(MouseEvent e) { <END> return null; }</code><technical_language>In order prevent creating API prefer composition inheritance, this package visible final, action/functional interface provided in constructor. Also, I feeling mouseHover mouseOut methods belong this class takes care of drawing. If so, action a basic Function<Void, Void> get rid of IInlinedAnnotationAction class</technical_language>

Target:
public Consumer<MouseEvent> getAction(MouseEvent e) { return null; }
Source:
<code>public void testOnCompletedMsgWithoutOperationId() { final AvroElasticMemoryMessage msgWithoutOperationId = AvroElasticMemoryMessage.newBuilder() .setType(Type.ResultMsg) .setSrcId("") .setDestId("") .build(); callbackRouter.onCompleted(msgWithoutOperationId); <START> assertTrue("No exceptions were thrown.", true); <END> }</code><technical_language>do need this assertion? If exception thrown, test fail anyway</technical_language>

Target:
public void testOnCompletedMsgWithoutOperationId() { final AvroElasticMemoryMessage msgWithoutOperationId = AvroElasticMemoryMessage.newBuilder() .setType(Type.ResultMsg) .setSrcId("") .setDestId("") .build(); callbackRouter.onCompleted(msgWithoutOperationId); }
Source:
<code>private FileListCacheValue getFileList() { <START> readLock.lock(); <END> try { FileListCacheValue fileList = (FileListCacheValue) cache.get(fileListCacheKey); if (fileList == null) { fileList = new FileListCacheValue(); FileListCacheValue prev = (FileListCacheValue) cache.putIfAbsent(fileListCacheKey, fileList); if (prev != null) { fileList = prev; } } if (trace) log.trace("Refreshed file listing view"); return fileList; } finally { readLock.unlock(); } }</code><technical_language>concerned this lock.. necessary operation invoking this private method is guarded already, a thread needs acquire locks I alarm bell ringing in head</technical_language>

Target:
private FileListCacheValue getFileList() { FileListCacheValue fileList = (FileListCacheValue) cache.get(fileListCacheKey); if (fileList == null) { fileList = new FileListCacheValue(); FileListCacheValue prev = (FileListCacheValue) cache.putIfAbsent(fileListCacheKey, fileList); if (prev != null) { fileList = prev; } } if (trace) log.trace("Refreshed file listing view"); return fileList; }
Source:
<code>public void setUp() { <START> storagePool = createStoragePool(new Version(3, 4)); <END> initCommand(); when(facade.getStoragePoolDao()).thenReturn(storagePoolDAO); when(facade.getStoragePoolDao().get(storagePool.getId())).thenReturn(storagePool); when(facade.getStorageDomainDao()).thenReturn(storageDomainDAO); when(storageDomainDAO.getAllForStoragePool(storagePool.getId())).thenReturn(attachedDomains); when(facade.getStoragePoolIsoMapDao()).thenReturn(storagePoolIsoMapDAO); when(storagePoolIsoMapDAO.getAllForStorage(any(Guid.class))).thenReturn(isoMap); }</code><technical_language>Version.v3_4</technical_language>

Target:
public void setUp() { storagePool = createStoragePool(Version.v3_4); initCommand(); when(facade.getStoragePoolDao()).thenReturn(storagePoolDAO); when(facade.getStoragePoolDao().get(storagePool.getId())).thenReturn(storagePool); when(facade.getStorageDomainDao()).thenReturn(storageDomainDAO); when(storageDomainDAO.getAllForStoragePool(storagePool.getId())).thenReturn(attachedDomains); when(facade.getStoragePoolIsoMapDao()).thenReturn(storagePoolIsoMapDAO); when(storagePoolIsoMapDAO.getAllForStorage(any(Guid.class))).thenReturn(isoMap); }
Source:
<code>private void validateVcardAddressBody(Body body) throws ParamValidationException, PropertyValidationException { validateSemanticTagVcardAddressBody(body); if (StringUtils.isBlank(body.getInternalType().toString()) <START> || !BodyInternalTypes.isVcardAddressTagBody(body.getInternalType())) <END> throw new ParamValidationException(ParamValidationException.MESSAGE_MISSING_MANDATORY_FIELD, I18nConstants.MESSAGE_MISSING_MANDATORY_FIELD, new String[] { "tag.body.type", body.getType().toString() }); }</code><technical_language>This validation done based internal type, (external) getType, validation for transcriptions</technical_language>

Target:
private void validateVcardAddressBody(Body body) throws ParamValidationException, PropertyValidationException { validateSemanticTagVcardAddressBody(body); }
Source:
<code>public void rateOfReturnCalculationTest() { List<Transaction> transactions = new ArrayList<>(); transactions.add(new PortfolioTransaction(LocalDateTime.of(2019, 01, 14, 12, 00), security.getCurrencyCode(), 1000L, security, 10L, Type.BUY, 0L, 0L)); transactions.add(createDividendTransaction(LocalDateTime.of(2019, 01, 15, 12, 00))); transactions.add(createDividendTransaction(LocalDateTime.of(2020, 01, 15, 12, 00))); <START> CostCalculation cost = Calculation.perform(CostCalculation.class, converter, security, transactions); <END> DividendCalculation dividends = Calculation.perform(DividendCalculation.class, converter, security, transactions); assertEquals(0.1, dividends.getRateOfReturnPerYear(), 0.0); }</code><technical_language>cost Object is -> needed</technical_language>

Target:
public void rateOfReturnCalculationTest() { List<Transaction> transactions = new ArrayList<>(); transactions.add(new PortfolioTransaction(LocalDateTime.of(2019, 01, 14, 12, 00), security.getCurrencyCode(), 1000L, security, 10L, Type.BUY, 0L, 0L)); transactions.add(createDividendTransaction(LocalDateTime.of(2019, 01, 15, 12, 00))); transactions.add(createDividendTransaction(LocalDateTime.of(2020, 01, 15, 12, 00))); @SuppressWarnings("unused") CostCalculation cost = Calculation.perform(CostCalculation.class, converter, security, transactions); DividendCalculation dividends = Calculation.perform(DividendCalculation.class, converter, security, transactions); assertEquals(0.1, dividends.getRateOfReturnPerYear(), 0.0); }
Source:
<code>protected HttpURLConnection put(String url, String body) throws IOException { if (url == null) { throw new IllegalArgumentException("SimplePush Update URL cannot be null"); } byte[] bytes = body.getBytes(UTF_8); HttpURLConnection conn = getConnection(url); conn.setDoOutput(true); conn.setUseCaches(false); conn.setFixedLengthStreamingMode(bytes.length); conn.setRequestProperty("Content-Length", "" + bytes.length); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); <START> conn.setRequestProperty("Accept", "*/*"); <END> conn.setRequestMethod("PUT"); OutputStream out = null; try { out = conn.getOutputStream(); out.write(bytes); out.flush(); } finally { if (out != null) { out.close(); } } return conn; }</code><technical_language>server, Mozilla, require UPS updated</technical_language>

Target:
protected HttpURLConnection put(String url, String body) throws IOException { if (url == null) { throw new IllegalArgumentException("SimplePush Update URL cannot be null"); } byte[] bytes = body.getBytes(UTF_8); HttpURLConnection conn = getConnection(url); conn.setDoOutput(true); conn.setUseCaches(false); conn.setFixedLengthStreamingMode(bytes.length); conn.setRequestProperty("Content-Length", Integer.toString(bytes.length)); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Accept", "*/*"); conn.setRequestMethod("PUT"); OutputStream out = null; try { out = conn.getOutputStream(); out.write(bytes); out.flush(); } finally { if (out != null) { out.close(); } } return conn; }
Source:
<code>public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); response.setContentLength(0); response.flushBuffer(); try { Thread.sleep(1000); } catch (InterruptedException x) { throw new InterruptedIOException(); } } }); String host = "localhost"; int port = connector.getLocalPort(); var request = client.newRequest(host, port) .scheme(scenario.getScheme()) .header(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE.asString()) .onRequestSuccess(r -> { HttpDestination destination = (HttpDestination)client.resolveDestination(r); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); HttpConnectionOverHTTP connection = (HttpConnectionOverHTTP)connectionPool.getActiveConnections().iterator().next(); assertFalse(connection.getEndPoint().isOutputShutdown()); }); <START> ContentResponse response = request.send(); <END> assertEquals(HttpStatus.OK_200, response.getStatus()); HttpDestination destination = (HttpDestination)client.resolveDestination(request); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); assertEquals(0, connectionPool.getConnectionCount()); }</code><technical_language>This line point of test: verify if server send Connection: close, client closes connection. restored</technical_language>

Target:
public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenario scenario) throws Exception { start(scenario, new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { baseRequest.setHandled(true); response.setContentLength(0); response.flushBuffer(); try { Thread.sleep(1000); } catch (InterruptedException x) { throw new InterruptedIOException(); } } }); String host = "localhost"; int port = connector.getLocalPort(); var request = client.newRequest(host, port) .scheme(scenario.getScheme()) .header(HttpHeader.CONNECTION, HttpHeaderValue.CLOSE.asString()) .onRequestSuccess(r -> { HttpDestination destination = (HttpDestination)client.resolveDestination(r); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); HttpConnectionOverHTTP connection = (HttpConnectionOverHTTP)connectionPool.getActiveConnections().iterator().next(); assertFalse(connection.getEndPoint().isOutputShutdown()); }) .onResponseHeaders(r -> { ((HttpResponse)r).getHeaderFieldsMutable().remove(HttpHeader.CONNECTION); }); ContentResponse response = request.send(); assertEquals(HttpStatus.OK_200, response.getStatus()); HttpDestination destination = (HttpDestination)client.resolveDestination(request); DuplexConnectionPool connectionPool = (DuplexConnectionPool)destination.getConnectionPool(); assertEquals(0, connectionPool.getConnectionCount()); }
Source:
<code>public void close() throws IOException { try { primaryAccountService.close(); } finally { <START> secondaryAccountService.close(); <END> } shutDownExecutorService(scheduler, config.consistencyCheckerShutdownTimeoutMinutes, TimeUnit.MINUTES); }</code><technical_language>I wrap close in a separate ry-catch executor shutdown get attempted</technical_language>

Target:
public void close() throws IOException { shutDownExecutorService(scheduler, config.consistencyCheckerShutdownTimeoutMinutes, TimeUnit.MINUTES); try { primaryAccountService.close(); } catch (Exception e) { logger.error("Close failed for primary source", e); } try { secondaryAccountService.close(); } catch (Exception e) { logger.error("Close failed for secondary source", e); } }
Source:
<code>protected MBStyleHandler(SLDHandler sldHandler) { super("JSON", FORMAT); <START> this.sldHandler = sldHandler; <END> }</code><technical_language>Name is GeoServer UI display style, MBStyle "JSON"</technical_language>

Target:
protected MBStyleHandler(SLDHandler sldHandler) { super("MBStyle", FORMAT); this.sldHandler = sldHandler; }
Source:
<code>public void testExternalTableCreationFailsIfNoCreateOrDropTablePresent() throws Exception { final int TOTAL_RECORDS = 1 * 10; String table = getTableName().toUpperCase(); ColumnGenerator[] cols = new ColumnGenerator[] { HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(0), "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, new HiveVarchar("1", 20), "1", KeyType.STATIC_KEY), HCatalogTestUtils.colGenerator(HCatalogTestUtils.forIdx(1), "varchar(20)", Types.VARCHAR, HCatFieldSchema.Type.STRING, 0, 0, new HiveVarchar("2", 20), "2", KeyType.DYNAMIC_KEY), }; List<String> addlArgsArray = new ArrayList<String>(); addlArgsArray.add("--hcatalog-external-table"); addlArgsArray.add("--hcatalog-storage-stanza"); addlArgsArray.add("\"stored as orc tblproperties (\"transactional\"=\"false\")\""); setExtraArgs(addlArgsArray); utils.dropHCatTableIfExists(table, SqoopHCatUtilities.DEFHCATDB); <START> try { <END> runHCatImport(addlArgsArray, TOTAL_RECORDS, table, cols, null, true, false); Assert.fail("--hcatalog-external-table cannot be used without signing creation of hcatalog table."); } catch (Exception e) { LOG.debug("Caught expected exception while running " + " hcatalog-external-table without signing create or drop-and-create test", e); } }</code><technical_language>please ExpectedException rule instead of a try-catch block here</technical_language>

Target:
public void testExternalTableCreationFailsIfNoCreateOrDropTablePresent() throws Exception { externalTableCreationCoreTest(true, "--" + HCATALOG_EXTERNAL_TABLE_ARG, "--" + HCATALOG_STORAGE_STANZA_ARG, TABLEPROPERTIES_ORC_NONTRANSACTIONAL); }
Source:
<code>public void shouldNotCreateNewEntryIFEntryAlreadyExsists() throws Exception { String newEntries = "[{\"id\": \"europe\", \"label\": \"europe\", \"obsolete\": 0}]"; Map<String, Object> params = new HashMap<>(); params.put("directoryName", "continent"); params.put("entries", newEntries); OperationParameters oparams = new OperationParameters(CreateDirectoryEntries.ID, params); OperationContext ctx = new OperationContext(session); OperationChain chain = new OperationChain("fakeChain"); chain.add(oparams); try { service.run(ctx, chain); fail(); } catch (NuxeoException e) { if (!(e instanceof DirectoryException)) { <START> fail(); <END> } assertEquals("Failed to invoke operation Directory.CreateEntries, Entry with id europe already exists", e.getMessage()); } }</code><technical_language>catch DirectoryException here</technical_language>

Target:
public void shouldNotCreateNewEntryIFEntryAlreadyExsists() throws Exception { String newEntries = "[{\"id\": \"europe\", \"label\": \"europe\", \"obsolete\": 0}]"; Map<String, Object> params = new HashMap<>(); params.put("directoryName", "continent"); params.put("entries", newEntries); OperationParameters oparams = new OperationParameters(CreateDirectoryEntries.ID, params); OperationContext ctx = new OperationContext(session); OperationChain chain = new OperationChain("fakeChain"); chain.add(oparams); try { service.run(ctx, chain); fail(); } catch (DirectoryException e) { assertEquals("Failed to invoke operation Directory.CreateEntries, Entry with id europe already exists", e.getMessage()); } }
Source:
<code>public static Map<String, Object> prepareLocationInfoForVdsCommand(LocationInfo locationInfo) { if (locationInfo instanceof ExternalLocationInfo) { ExternalLocationInfo info = (ExternalLocationInfo)locationInfo; if (ConnectionMethod.HTTP.equals(info.getConnectionMethod())) { HttpLocationInfo httpInfo = (HttpLocationInfo) info; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("method", "http"); infoMap.put("url", httpInfo.getUrl()); infoMap.put("headers", httpInfo.getHeaders()); return infoMap; } } if (locationInfo instanceof VdsmImageLocationInfo) { VdsmImageLocationInfo info = (VdsmImageLocationInfo)locationInfo; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("endpoint_type", "div"); infoMap.put("sd_id", info.getStorageDomainId().toString()); infoMap.put("img_id", info.getImageGroupId().toString()); infoMap.put("vol_id", info.getImageId().toString()); <START> infoMap.put("generation", info.getGeneration()); <END> return infoMap; } throw new RuntimeException("Unsupported location info"); }</code><technical_language>please add a null check, map if specified</technical_language>

Target:
public static Map<String, Object> prepareLocationInfoForVdsCommand(LocationInfo locationInfo) { if (locationInfo instanceof ExternalLocationInfo) { ExternalLocationInfo info = (ExternalLocationInfo)locationInfo; if (ConnectionMethod.HTTP.equals(info.getConnectionMethod())) { HttpLocationInfo httpInfo = (HttpLocationInfo) info; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("method", "http"); infoMap.put("url", httpInfo.getUrl()); infoMap.put("headers", httpInfo.getHeaders()); return infoMap; } } if (locationInfo instanceof VdsmImageLocationInfo) { VdsmImageLocationInfo info = (VdsmImageLocationInfo)locationInfo; Map<String, Object> infoMap = new HashMap<>(); infoMap.put("endpoint_type", "div"); infoMap.put("sd_id", info.getStorageDomainId().toString()); infoMap.put("img_id", info.getImageGroupId().toString()); infoMap.put("vol_id", info.getImageId().toString()); if (info.getGeneration() != null) { infoMap.put("generation", info.getGeneration()); } return infoMap; } throw new RuntimeException("Unsupported location info"); }
Source:
<code>private void updateCards(JSONObject model) { Timber.d("updateCards()"); try { JSONArray tmpls = model.getJSONArray("tmpls"); String cardsList = ""; Timber.d("updateCards() template count is %s", tmpls.length()); for (int i = 0; i < tmpls.length(); i++) { String name = tmpls.getJSONObject(i).optString("name"); if (!mAddNote && tmpls.length() > 1 && model == mEditorNote.model() && <START> mCurrentEditedCard.getOrd() < tmpls.length() && <END> mCurrentEditedCard.template().optString("name").equals(name)) { name = "<u>" + name + "</u>"; } cardsList += name; if (i < tmpls.length()-1) { cardsList += ", "; } } if (!mAddNote && tmpls.length() < mEditorNote.model().getJSONArray("tmpls").length()) { cardsList = "<font color='red'>" + cardsList + "</font>"; } mCardsButton.setText(Html.fromHtml(getResources().getString(R.string.CardEditorCards, cardsList))); } catch (JSONException e) { throw new RuntimeException(e); } }</code><technical_language>Surely other problems if editing a card exist anymore</technical_language>

Target:
private void updateCards(JSONObject model) { Timber.d("updateCards()"); try { JSONArray tmpls = model.getJSONArray("tmpls"); String cardsList = ""; Timber.d("updateCards() template count is %s", tmpls.length()); for (int i = 0; i < tmpls.length(); i++) { String name = tmpls.getJSONObject(i).optString("name"); if (!mAddNote && tmpls.length() > 1 && model == mEditorNote.model() && mCurrentEditedCard.template().optString("name").equals(name)) { name = "<u>" + name + "</u>"; } cardsList += name; if (i < tmpls.length()-1) { cardsList += ", "; } } if (!mAddNote && tmpls.length() < mEditorNote.model().getJSONArray("tmpls").length()) { cardsList = "<font color='red'>" + cardsList + "</font>"; } mCardsButton.setText(Html.fromHtml(getResources().getString(R.string.CardEditorCards, cardsList))); } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
<code>public void scan(HttpMessage msg, NameValuePair originalParam) { paramType = originalParam.getType(); <START> scan(msg, originalParam.getName(), originalParam.getValue()); <END> }</code><technical_language>delegate base class instead, super.scan(msg, originalParam);</technical_language>

Target:
public void scan(HttpMessage msg, NameValuePair originalParam) { currentParamType = originalParam.getType(); super.scan(msg, originalParam); }
Source:
<code>private void sendPack(PackStatistics.Accumulator accumulator, FetchRequest req, @Nullable Collection<Ref> allTags, List<ObjectId> unshallowCommits) throws IOException { Set<String> <START> cc = <END> req.getClientCapabilities(); boolean sideband = cc.contains(OPTION_SIDE_BAND) || cc.contains(OPTION_SIDE_BAND_64K); if (sideband) { try { sendPack(true, req, accumulator, allTags, unshallowCommits); } catch (ServiceMayNotContinueException noPack) { throw noPack; } catch (IOException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (RuntimeException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (Error err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } } else { sendPack(false, req, accumulator, allTags, unshallowCommits); } }</code><technical_language>clientCaps something</technical_language>

Target:
private void sendPack(PackStatistics.Accumulator accumulator, FetchRequest req, @Nullable Collection<Ref> allTags, List<ObjectId> unshallowCommits) throws IOException { Set<String> caps = req.getClientCapabilities(); boolean sideband = caps.contains(OPTION_SIDE_BAND) || caps.contains(OPTION_SIDE_BAND_64K); if (sideband) { try { sendPack(true, req, accumulator, allTags, unshallowCommits); } catch (ServiceMayNotContinueException noPack) { throw noPack; } catch (IOException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (RuntimeException err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } catch (Error err) { if (reportInternalServerErrorOverSideband()) throw new UploadPackInternalServerErrorException(err); else throw err; } } else { sendPack(false, req, accumulator, allTags, unshallowCommits); } }
Source:
<code>public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Attribute unixGIDNamespaceAttribute = sess.getPerunBl().getModulesUtilsBl().getUnixGIDNamespaceAttributeWithNotNullValue(sess, resource); Attribute gidAttribute; try { gidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + unixGIDNamespaceAttribute.getValue()); } catch(AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } gidAttribute.setValue(attribute.getValue()); try { sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSemantics(sess, group, gidAttribute); <START> } catch(WrongReferenceAttributeValueException ex) { <END> throw new WrongReferenceAttributeValueException(attribute, ex.getAttribute(), ex); } }</code><technical_language>checking syntax semantics in method checkAttributeSemantics in module virt_googleGroupName, checking forceCheckAttributeSemantics. implemented for virt modules? do @stavamichal</technical_language>

Target:
public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Resource resource, Attribute attribute) throws InternalErrorException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Attribute unixGIDNamespaceAttribute = sess.getPerunBl().getModulesUtilsBl().getUnixGIDNamespaceAttributeWithNotNullValue(sess, resource); Attribute gidAttribute; try { gidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + unixGIDNamespaceAttribute.getValue()); } catch(AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } gidAttribute.setValue(attribute.getValue()); try { sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSyntax(sess, group, gidAttribute); sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSemantics(sess, group, gidAttribute); } catch(WrongReferenceAttributeValueException | WrongAttributeValueException ex) { throw new WrongReferenceAttributeValueException(attribute, ex.getAttribute(), ex); } }