auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private NickManager(XMPPConnection connection) { super(connection); connection.addSyncStanzaListener(new StanzaListener() { @Override public void processStanza(Stanza packet) throws SmackException.NotConnectedException, InterruptedException, SmackException.NotLoggedInException { final Message message = (Message) packet; asyncButOrdered.performAsyncButOrdered(message, new Runnable() { @Override public void run() { <START> for (NickListener listener : nickListeners) { <END> listener.newNickMessage(message); } } }); } }, INCOMING_MESSAGE_FILTER); }</code><technical_language>nickListeners is synchronized</technical_language>

Target:
private NickManager(XMPPConnection connection) { super(connection); connection.addSyncStanzaListener(new StanzaListener() { @Override public void processStanza(Stanza packet) throws SmackException.NotConnectedException, InterruptedException, SmackException.NotLoggedInException { final Message message = (Message) packet; Jid from = message.getFrom(); if (from != null) { asyncButOrdered.performAsyncButOrdered(from, new Runnable() { @Override public void run() { synchronized (nickListeners) { for (NickListener listener : nickListeners) { listener.newNickMessage(message); } } } }); } } }, INCOMING_MESSAGE_FILTER); }
Source:
<code>public void testCompaction(int N) throws Exception { FileReftableStack <START> stack = <END> new FileReftableStack(new File(reftableDir, "refs"), reftableDir, null, () -> new Config()); for (int i = 0; i < N; i++) { final long next = stack.getMergedReftable().maxUpdateIndex()+1; String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); Ref r = newRef(name, ObjectId.zeroId()); boolean ok = stack.addReftable(rw -> { rw.setMinUpdateIndex(next).setMaxUpdateIndex(next).begin() .writeRef(r); }); assertTrue(ok); } MergedReftable table = stack.getMergedReftable(); for (int i = 1; i < N; i++) { String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); RefCursor c = table.seekRef(name); assertTrue(c.next()); assertEquals(ObjectId.zeroId(), c.getRef().getObjectId()); } List<String> files = Arrays.asList(reftableDir.listFiles()).stream() .map(File::getName).collect(Collectors.toList()); Collections.sort(files); assertTrue(files.size() < 20); FileReftableStack.CompactionStats stats = stack.getStats(); assertEquals(0, stats.failed); assertTrue(stats.attempted < N); assertTrue(stats.refCount < FileReftableStack.log(N) * N); }</code><technical_language>stack closed</technical_language>

Target:
public void testCompaction(int N) throws Exception { try (FileReftableStack stack = new FileReftableStack( new File(reftableDir, "refs"), reftableDir, null, () -> new Config())) { for (int i = 0; i < N; i++) { final long next = stack.getMergedReftable().maxUpdateIndex() + 1; String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); Ref r = newRef(name, ObjectId.zeroId()); boolean ok = stack.addReftable(rw -> { rw.setMinUpdateIndex(next).setMaxUpdateIndex(next).begin() .writeRef(r); }); assertTrue(ok); } MergedReftable table = stack.getMergedReftable(); for (int i = 1; i < N; i++) { String name = String.format("refs/heads/branch%d", Integer.valueOf(i)); RefCursor c = table.seekRef(name); assertTrue(c.next()); assertEquals(ObjectId.zeroId(), c.getRef().getObjectId()); } List<String> files = Arrays.asList(reftableDir.listFiles()).stream() .map(File::getName).collect(Collectors.toList()); Collections.sort(files); assertTrue(files.size() < 20); FileReftableStack.CompactionStats stats = stack.getStats(); assertEquals(0, stats.failed); assertTrue(stats.attempted < N); assertTrue(stats.refCount < FileReftableStack.log(N) * N); } }
Source:
<code>public void tokenize(SourceCode sourceCode, Tokens tokenEntries) { StringBuilder buffer = sourceCode.getCodeBuffer(); <START> GroovyLexer lexer = new GroovyLexer(IOUtils.toInputStream(buffer.toString(), StandardCharsets.UTF_8)); <END> TokenStream tokenStream = lexer.plumb(); try { Token token = tokenStream.nextToken(); while (token.getType() != Token.EOF_TYPE) { TokenEntry tokenEntry = new TokenEntry(token.getText(), sourceCode.getFileName(), token.getLine()); tokenEntries.add(tokenEntry); token = tokenStream.nextToken(); } } catch (TokenStreamException err) { throw new TokenMgrError("Lexical error in file " + sourceCode.getFileName() + " at line " + lexer.getLine() + ", column " + lexer.getColumn() + ". Encountered: " + err.getMessage(), TokenMgrError.LEXICAL_ERROR); } finally { tokenEntries.add(TokenEntry.getEOF()); } }</code><technical_language>of changes, of test code. change correct. However, I know, Charset GroovyLexer is expecting... So, constructor, takes a Reader: GroovyLexer lexer = new GroovyLexer(new StringReader(buffer.toString()));</technical_language>

Target:
public void tokenize(SourceCode sourceCode, Tokens tokenEntries) { StringBuilder buffer = sourceCode.getCodeBuffer(); GroovyLexer lexer = new GroovyLexer(new StringReader(buffer.toString())); TokenStream tokenStream = lexer.plumb(); try { Token token = tokenStream.nextToken(); while (token.getType() != Token.EOF_TYPE) { TokenEntry tokenEntry = new TokenEntry(token.getText(), sourceCode.getFileName(), token.getLine()); tokenEntries.add(tokenEntry); token = tokenStream.nextToken(); } } catch (TokenStreamException err) { throw new TokenMgrError("Lexical error in file " + sourceCode.getFileName() + " at line " + lexer.getLine() + ", column " + lexer.getColumn() + ". Encountered: " + err.getMessage(), TokenMgrError.LEXICAL_ERROR); } finally { tokenEntries.add(TokenEntry.getEOF()); } }
Source:
<code><START> V put(final K key, final V value) { <END> final V returnValue = clusterRegistry.put(scope, key, value); localCacheInsert(key, value); return returnValue; }</code><technical_language>Do returned value? put in cluster registry IGNORE_RETURN_VALUES</technical_language>

Target:
void put(final K key, final V value) { clusterRegistry.put(scope, key, value); localCacheInsert(key, value); }
Source:
<code>public void sendCssText(String cssText) { waitForElementByElement(aceLayerTextArea); <START> executeScript("ace.edit('cssEditorContainer').setValue('"+ cssText +"');"); <END> PageObjectLogging.log("sendCssText", "the following text was send to ace editor: "+cssText, true, driver); }</code><technical_language>1. create method clearCSS() ace.edit('cssEditorContainer').setValue('') 2. add .ace_text-input element UI mapping - this is cursor, 3. in sendCssText sendKeys method type cursor</technical_language>

Target:
public void sendCssText(String cssText) { waitForElementByElement(aceLayerTextArea); waitForElementByElement(aceInputTextArea); aceInputTextArea.sendKeys(cssText); PageObjectLogging.log("sendCssText", "the following text was send to ace editor: "+cssText, true, driver); }
Source:
<code>public BtMpxChannelDataIngester productionChannelGroupUpdater() { <START> return perEnvironmentChannelGroupUpdater(Publisher.BT_TV_CHANNELS, PROD_ALIAS_NAMESPACE_PREFIX, baseUri, Boolean.parseBoolean(productionIngestAdvertiseFrom), productionNamespace); <END> }</code><technical_language>line length +</technical_language>

Target:
public BtMpxChannelDataIngester productionChannelGroupUpdater() { return perEnvironmentChannelGroupUpdater(Publisher.BT_TV_CHANNELS, ALIAS_NAMESPACE_PREFIX, baseUri, Boolean.parseBoolean(productionIngestAdvertiseFrom), productionNamespace); }
Source:
<code>public void testGetVdsCountByStoragePoolId() { <START> Integer result = dao.GetVdsCountByStoragePoolId(existingVds.getstorage_pool_id()); <END> assertNotNull(result); assertEquals(new Integer(getAllForStoragePool(existingVds).size()), result); }</code><technical_language>change API ints, need Integer mess here</technical_language>

Target:
public void testGetVdsCountByStoragePoolId() { Integer result = dao.getVdsCountByStoragePoolId(existingVds.getstorage_pool_id()); assertNotNull(result); assertEquals(new Integer(getAllForStoragePool(existingVds).size()), result); }
Source:
<code>private void warnIfJavaVersionOutdated() { try { JavaVersion javaRuntimeVersion = JavaVersion.fromString(System.getProperty("java.runtime.version")); <START> JavaVersion javaRequiredVersion = JavaVersion.fromString(JavaVersion.REQUIRED_VERSION); <END> if (JavaVersion.isJavaVersionTooLow(javaRuntimeVersion, javaRequiredVersion)) { showJavaVersionOutdatedWarning(javaRuntimeVersion, javaRequiredVersion); } } catch (IllegalArgumentException e) { logger.error("Java Version string failed to be parsed.", e); } }</code><technical_language>required version a property of application (UI) instead. This is a bit verbose. drop some of prefixes for local variables (which ambiguous)</technical_language>

Target:
private void warnIfJavaVersionOutdated() { JavaVersion requiredVersion; try { requiredVersion = JavaVersion.fromString(REQUIRED_JAVA_VERSION); } catch (IllegalArgumentException e) { logger.error("Required Java Version string cannot be parsed. This should have been covered by test."); assert false; return; } JavaVersion runtimeVersion; String javaRuntimeVersionString = System.getProperty("java.runtime.version"); try { runtimeVersion = JavaVersion.fromString(javaRuntimeVersionString); } catch (IllegalArgumentException e) { logger.error("Runtime Java Version string cannot be parsed. Look at Java Doc about other version format."); showJavaRuntimeVersionNotCompatible(System.getProperty("java.runtime.version")); return; } if (JavaVersion.isJavaVersionLower(runtimeVersion, requiredVersion)) { showJavaVersionOutdatedWarning(runtimeVersion, requiredVersion); } }
Source:
<code>public void addRemoveContentToIndex () throws Exception { Structure testStructure = loadTestStructure(); Contentlet testContentlet = loadTestContentlet( testStructure ); try { testContentlet.setIndexPolicy(IndexPolicy.WAIT_FOR); indexAPI.addContentToIndex( testContentlet ); contentletAPI.isInodeIndexed( testContentlet.getInode(), true ); String query = "+structureName:" + testStructure.getVelocityVarName() + " +deleted:false +live:true"; List<Contentlet> result = contentletAPI.search( query, 0, -1, "modDate desc", user, true ); assertNotNull( result ); assertTrue( !result.isEmpty() ); indexAPI.removeContentFromIndex( testContentlet ); <START> wasContentRemoved( query + " " + UUIDGenerator.generateUuid() ); <END> result = contentletAPI.search( query + " " + UUIDGenerator.generateUuid(), 0, -1, "modDate desc", user, true ); assertTrue( result == null || result.isEmpty() ); } finally { try { contentletAPI.destroy(testContentlet, user, false ); } catch (Exception e) { e.printStackTrace(); } contentTypeAPI.delete(new StructureTransformer(testStructure).from()); } }</code><technical_language>@wezell is uuid stuff required yet</technical_language>

Target:
public void addRemoveContentToIndex () throws Exception { Structure testStructure = loadTestStructure(); Contentlet testContentlet = loadTestContentlet( testStructure ); try { testContentlet.setIndexPolicy(IndexPolicy.WAIT_FOR); indexAPI.addContentToIndex( testContentlet ); contentletAPI.isInodeIndexed( testContentlet.getInode(), true ); String query = "+structureName:" + testStructure.getVelocityVarName() + " +deleted:false +live:true"; List<Contentlet> result = contentletAPI.search( query, 0, -1, "modDate desc", user, true ); assertNotNull( result ); assertTrue( !result.isEmpty() ); indexAPI.removeContentFromIndex( testContentlet ); wasContentRemoved( query ); result = contentletAPI.search( query, 0, -1, "modDate desc", user, true ); assertTrue( result == null || result.isEmpty() ); } finally { try { contentletAPI.destroy(testContentlet, user, false ); } catch (Exception e) { e.printStackTrace(); } contentTypeAPI.delete(new StructureTransformer(testStructure).from()); } }
Source:
<code>private String getKey(OMElement pool, QName qName) { OMElement ele = pool.getFirstChildWithName(qName); if (ele != null) { return ele.getAttributeValue(new QName(ATT_KEY)); <START> } else { <END> return null; } }</code><technical_language>remove else block replacing in return. (No added advantage for runtime, for clean code)</technical_language>

Target:
private String getKey(OMElement pool, QName qName) { OMElement ele = pool.getFirstChildWithName(qName); if (ele != null) { return ele.getAttributeValue(new QName(ATT_KEY)); } return null; }
Source:
<code>public FileChangeWatcher(Path dirPath, Consumer<WatchEvent<?>> callback) throws IOException { FileSystem fs = dirPath.getFileSystem(); WatchService watchService = fs.newWatchService(); if (LOG.isDebugEnabled()) { LOG.debug("Registering with watch service: " + dirPath); } dirPath.register( watchService, new WatchEvent.Kind<?>[]{ StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.OVERFLOW}, SensitivityWatchEventModifier.HIGH); this.watcherThread = new WatcherThread(watchService, callback); this.watcherThread.setDaemon(true); <START> this.watcherThread.start(); <END> }</code><technical_language>defining life cycle for file watcher start, stop etc. define state of file watcher starting, running, started stopping etc. locking is required if define states. clients leverage states if tasks depending file watcher state</technical_language>

Target:
public FileChangeWatcher(Path dirPath, Consumer<WatchEvent<?>> callback) throws IOException { FileSystem fs = dirPath.getFileSystem(); WatchService watchService = fs.newWatchService(); if (LOG.isDebugEnabled()) { LOG.debug("Registering with watch service: " + dirPath); } dirPath.register( watchService, new WatchEvent.Kind<?>[]{ StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.OVERFLOW}, SensitivityWatchEventModifier.HIGH); state = State.NEW; this.watcherThread = new WatcherThread(watchService, callback); this.watcherThread.setDaemon(true); }
Source:
<code>public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); <START> if(!world.isRemote){return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);} <END> player.openGui(LogisticsPipes.instance, GuiIDs.GUI_Guide_Book_ID, world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack); }</code><technical_language>new ActionResult<ItemStack> -> new ActionResult<></technical_language>

Target:
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); if (world.isRemote) MainProxy.proxy.openGuideBookGui(hand); return new ActionResult<>(EnumActionResult.SUCCESS, itemstack); }
Source:
<code>public Collection<KeyValueAnnotation> responseAnnotations() { <START> KeyValueAnnotation statusAnnotation = KeyValueAnnotation.create( <END> "http.responsecode", String.valueOf(response.getHttpStatusCode())); return Arrays.asList(statusAnnotation); }</code><technical_language>ps this is a logic change. saves size log 2xx range responses. <LINK_0></technical_language>

Target:
public Collection<KeyValueAnnotation> responseAnnotations() { KeyValueAnnotation statusAnnotation = KeyValueAnnotation.create( TraceKeys.HTTP_STATUS_CODE, String.valueOf(response.getHttpStatusCode())); return Arrays.asList(statusAnnotation); }
Source:
<code>public TrieRoutingData(Map<String, List<String>> routingData) throws InvalidRoutingDataException { <START> if (isRootShardingKey(routingData)) { <END> Map.Entry<String, List<String>> entry = routingData.entrySet().iterator().next(); _rootNode = new TrieNode(Collections.emptyMap(), "/", true, entry.getKey()); } else { _rootNode = new TrieNode(new HashMap<>(), "/", false, ""); constructTrie(routingData); } }</code><technical_language>Is this necessary special handling? constructTrie logic handle root sharding key</technical_language>

Target:
public TrieRoutingData(Map<String, List<String>> routingData) throws InvalidRoutingDataException { if (routingData == null || routingData.isEmpty()) { throw new InvalidRoutingDataException("routingData cannot be null or empty"); } if (isRootShardingKey(routingData)) { Map.Entry<String, List<String>> entry = routingData.entrySet().iterator().next(); _rootNode = new TrieNode(Collections.emptyMap(), "/", true, entry.getKey()); } else { _rootNode = new TrieNode(new HashMap<>(), "/", false, ""); constructTrie(routingData); } }
Source:
<code>public void assertAmbiguous() { RegexUrlPatternMap<Integer> urlPatternMap = new RegexUrlPatternMap<>(); urlPatternMap.put("/foo/{bar}/{fooName}/status", 10); urlPatternMap.put("/foo/{bar}/operate/{metrics}", 11); MappingContext<Integer> mappingContext = urlPatternMap.match("/foo/barValue/operate/status"); assertNotNull(mappingContext); <START> assertEquals("/foo/{bar}/operate/{metrics}", mappingContext.pattern()); <END> assertEquals(Integer.valueOf(11), mappingContext.payload()); }</code><technical_language>assertThat</technical_language>

Target:
public void assertAmbiguous() { RegexUrlPatternMap<Integer> urlPatternMap = new RegexUrlPatternMap<>(); urlPatternMap.put("/foo/{bar}/{fooName}/status", 10); urlPatternMap.put("/foo/{bar}/operate/{metrics}", 11); MappingContext<Integer> mappingContext = urlPatternMap.match("/foo/barValue/operate/status"); assertNotNull(mappingContext); assertThat(mappingContext.pattern(), is("/foo/{bar}/operate/{metrics}")); assertThat(mappingContext.payload(), is(11)); }
Source:
<code>private static void extractToDirectory(File directory, JarInputStream input) throws IOException { File manifestFile = new File(directory, JarFile.MANIFEST_NAME); manifestFile.getParentFile().mkdirs(); input.getManifest().write(new FileOutputStream(manifestFile)); JarEntry entry = input.getNextJarEntry(); while (entry != null) { File newFile = new File(directory, entry.getName()); if (entry.isDirectory()) { newFile.mkdirs(); } else { FileOutputStream fileoutputstream = new FileOutputStream(newFile); IOUtils.copy(input, fileoutputstream); <START> fileoutputstream.close(); <END> } input.closeEntry(); entry = input.getNextJarEntry(); } }</code><technical_language>do this in try() - finally block ensure outputstream is closed</technical_language>

Target:
private static void extractToDirectory(File directory, JarInputStream input) throws IOException { File manifestFile = new File(directory, JarFile.MANIFEST_NAME); manifestFile.getParentFile().mkdirs(); try (FileOutputStream output = new FileOutputStream(manifestFile)) { input.getManifest().write(output); } JarEntry entry = input.getNextJarEntry(); while (entry != null) { File newFile = new File(directory, entry.getName()); if (entry.isDirectory()) { newFile.mkdirs(); } else { try (FileOutputStream output = new FileOutputStream(newFile)) { IOUtils.copy(input, output); } } input.closeEntry(); entry = input.getNextJarEntry(); } }
Source:
<code>public String getRpmRevision() { <START> return this.rpmRevison; <END> }</code><technical_language>typo above, be: return this.rpmRevision;</technical_language>

Target:
public String getRpmRevision() { return this.rpmRevision; }
Source:
<code>private Project getProjectFromSession() { ISarosSession currentSession = sarosSession; if (currentSession == null) { return null; } <START> SharedIDEContext sharedIDEContext = currentSession.getComponent(SharedIDEContext.class); <END> if (!sharedIDEContext.isInitialized()) { return null; } return sharedIDEContext.getProject(); }</code><technical_language>Nullcheck missing</technical_language>

Target:
private Project getProjectFromSession() { ISarosSession currentSession = sarosSession; if (currentSession == null) { return null; } SharedIDEContext sharedIDEContext = currentSession.getComponent(SharedIDEContext.class); if (sharedIDEContext == null || !sharedIDEContext.isInitialized()) { return null; } return sharedIDEContext.getProject(); }
Source:
<code><START> public CacheCollection<V> values(EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { <END> return new ValueCacheCollection<>(this, cacheEntrySet(explicitFlags, explicitClassLoader)); }</code><technical_language>This public</technical_language>

Target:
CacheCollection<V> values(EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { return new ValueCacheCollection<>(this, cacheEntrySet(explicitFlags, explicitClassLoader)); }
Source:
<code>protected void store(A aggregate) { <START> Write<I> operation = Write.<I>operation() <END> .into(this) .write(aggregate) .prepare(); operation.perform(); }</code><technical_language>need Builder for args. a factory method</technical_language>

Target:
protected void store(A aggregate) { Write<I> operation = Write.operationFor(this, aggregate); operation.perform(); }
Source:
<code>protected void configureGraphicalViewer() { super.configureGraphicalViewer(); AdvancedScrollingGraphicalViewer viewer = (AdvancedScrollingGraphicalViewer) <START> getGraphicalViewer(); <END> ScalableFreeformRootEditPart root = createRootEditPart(); ContextMenuProvider cmp = getContextMenuProvider(viewer, root.getZoomManager()); if (cmp != null) { viewer.setContextMenu(cmp); getSite().registerContextMenu("org.eclipse.fordiac.ide.gef.contextmenu", cmp, viewer); } viewer.setRootEditPart(root); viewer.setEditPartFactory(getEditPartFactory()); AdvancedGraphicalViewerKeyHandler keyHandler = new AdvancedGraphicalViewerKeyHandler(viewer); viewer.setKeyHandler(keyHandler); viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON); }</code><technical_language>I find nicer override getGraphicalViewer cast their. Similar do getModel methods in editparts</technical_language>

Target:
protected void configureGraphicalViewer() { super.configureGraphicalViewer(); AdvancedScrollingGraphicalViewer viewer = getGraphicalViewer(); ScalableFreeformRootEditPart root = createRootEditPart(); ContextMenuProvider cmp = getContextMenuProvider(viewer, root.getZoomManager()); if (cmp != null) { viewer.setContextMenu(cmp); getSite().registerContextMenu("org.eclipse.fordiac.ide.gef.contextmenu", cmp, viewer); } viewer.setRootEditPart(root); viewer.setEditPartFactory(getEditPartFactory()); AdvancedGraphicalViewerKeyHandler keyHandler = new AdvancedGraphicalViewerKeyHandler(viewer); viewer.setKeyHandler(keyHandler); viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON); }
Source:
<code>public UserSession signIn(Study study, CriteriaContext context, SignIn signIn) throws EntityNotFoundException { checkNotNull(study); checkNotNull(context); checkNotNull(signIn); Validate.entityThrowingException(SignInValidator.PASSWORD_SIGNIN, signIn); Account account = accountDao.authenticate(study, signIn); if (intentService.registerIntentToParticipate(study, account)) { account = accountDao.getAccount(AccountId.forId(study.getIdentifier(), account.getId())); <START> } <END> UserSession session = getSessionFromAccount(study, context, account); cacheProvider.setUserSession(session); if (!session.doesConsent() && !session.isInRole(Roles.ADMINISTRATIVE_ROLES)) { throw new ConsentRequiredException(session); } return session; }</code><technical_language>this is non-trivial executed sign-in, a lot. move this verify channel, is executed once? (Similarly channelSignIn())</technical_language>

Target:
public UserSession signIn(Study study, CriteriaContext context, SignIn signIn) throws EntityNotFoundException { checkNotNull(study); checkNotNull(context); checkNotNull(signIn); Validate.entityThrowingException(SignInValidator.PASSWORD_SIGNIN, signIn); Account account = accountDao.authenticate(study, signIn); UserSession session = getSessionFromAccount(study, context, account); if (!session.doesConsent() && intentService.registerIntentToParticipate(study, account)) { AccountId accountId = AccountId.forId(study.getIdentifier(), account.getId()); account = accountDao.getAccount(accountId); session = getSessionFromAccount(study, context, account); } cacheProvider.setUserSession(session); if (!session.doesConsent() && !session.isInRole(Roles.ADMINISTRATIVE_ROLES)) { throw new ConsentRequiredException(session); } return session; }
Source:
<code>public void previous() { if (currentStation != null) <START> new GetRealLinkAndPlayTask(itsContext, currentStation, itsBinder).execute(); <END> }</code><technical_language>Plays current, previous</technical_language>

Target:
public void previous() { RadioDroidApp radioDroidApp = (RadioDroidApp) getApplication(); DataRadioStation station = radioDroidApp.getFavouriteManager().getPreviousById(currentStation.StationUuid); if (station != null) { Utils.Play(radioDroidApp, station, itsContext, false); } }
Source:
<code>protected boolean validateShareableDisk() { if (DiskStorageType.IMAGE != _oldDisk.getDiskStorageType()) { return true; } boolean isDiskUpdatedToShareable = getParameters().getDiskInfo().isShareable(); boolean isDiskShareable = _oldDisk.isShareable(); if (!isDiskShareable && isDiskUpdatedToShareable) { ((DiskImage)_oldDisk).setvm_snapshot_id(null); _oldDisk.setAllowSnapshot(Boolean.FALSE); List<DiskImage> diskImageList = getDiskImageDao().getAllSnapshotsForImageGroup(_oldDisk.getId()); if ((diskImageList.size() > 1) || getParameters().getDiskInfo().isBoot() || !Guid.Empty.equals(((DiskImage)_oldDisk).getit_guid())) { addCanDoActionMessage(VdcBllMessages.SHAREABLE_DISK_IS_NOT_SUPPORTED_FOR_DISK); <START> return false; <END> } } else if (isDiskShareable && !isDiskUpdatedToShareable) { VM vm = getVmDAO().getForImageGroup(_oldDisk.getId()); if (vm != null) { ((DiskImage)_oldDisk).setvm_snapshot_id(dbFacade.getSnapshotDao().getId(vm.getId(), SnapshotType.ACTIVE).getValue()); } _oldDisk.setAllowSnapshot(Boolean.TRUE); } if (ImagesHandler.isVmInPreview(getVmId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW); return false; } return true; }</code><technical_language>u return false here, u updated _oldDisk garbage</technical_language>

Target:
protected boolean validateShareableDisk() { if (DiskStorageType.IMAGE != _oldDisk.getDiskStorageType()) { return true; } boolean isDiskUpdatedToShareable = getParameters().getDiskInfo().isShareable(); boolean isDiskShareable = _oldDisk.isShareable(); if (ImagesHandler.isVmInPreview(getVmId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW); return false; } if (!isDiskShareable && isDiskUpdatedToShareable) { ((DiskImage)_oldDisk).setvm_snapshot_id(null); List<DiskImage> diskImageList = getDiskImageDao().getAllSnapshotsForImageGroup(_oldDisk.getId()); if ((diskImageList.size() > 1) || getParameters().getDiskInfo().isBoot() || !Guid.Empty.equals(((DiskImage)_oldDisk).getit_guid())) { addCanDoActionMessage(VdcBllMessages.SHAREABLE_DISK_IS_NOT_SUPPORTED_FOR_DISK); return false; } _oldDisk.setAllowSnapshot(Boolean.FALSE); } else if (isDiskShareable && !isDiskUpdatedToShareable) { ((DiskImage)_oldDisk).setvm_snapshot_id(dbFacade.getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE).getValue()); _oldDisk.setAllowSnapshot(Boolean.TRUE); } return true; }
Source:
<code>public static void assumeJavaVersion(JavaVersion version) { <START> assumeThat( "java.specification.version: ", <END> SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) ); }</code><technical_language>Nice PR. SystemUtils.JAVA_SPECIFICATION_VERSION + ": instead. Do static imports</technical_language>

Target:
public static void assumeJavaVersion( JavaVersion version ) { assumeTrue( "java.specification.version: " + JAVA_SPECIFICATION_VERSION, SystemUtils.isJavaVersionAtLeast( version ) ); }
Source:
<code>public void handleConnectionsWithoutOriginInTheRequest() throws Exception { <START> final Take take = new TkFake(new RsText()); <END> final Take cors = new TkCORS(take); final RsPrint response = new RsPrint(cors.act(new RqFake())); final String head = response.printHead(); MatcherAssert.assertThat( "Invalid HTTP status for a request without origin.", head, Matchers.containsString(Response.HTTP_STATUS_200) ); }</code><technical_language>@antonini a one-time variable: <LINK_2></technical_language>

Target:
public void handleConnectionsWithoutOriginInTheRequest() throws Exception { MatcherAssert.assertThat( "It was expected to receive a 403 error.", new TkCORS( new TkFixed(new RsText()), "<LINK_0>", "<LINK_1>" ).act(new RqFake()), new HmRsStatus(Matchers.equalTo(HttpURLConnection.HTTP_FORBIDDEN)) ); }
Source:
<code>public String getSQL() { StringBuffer sb = new StringBuffer(); sb.append(m_def.getName()).append(Tokens.T_OPENBRACKET); switch (m_def.getId()) { case FunctionId.FUNC_VOLT_SINCE_EPOCH: case FunctionId.FUNC_VOLT_TO_TIMESTAMP: case FunctionId.FUNC_VOLT_TRUNCATE_TIMESTAMP: { int timeUnit = ((Number) nodes[0].valueData).intValue(); sb.append(Tokens.getKeyword(timeUnit)); break; } default: sb.append(nodes[0].getSQL()); break; } for (int ii = 1; ii < nodes.length; ii++) { if (nodes[ii] != null) { sb.append(Tokens.T_COMMA).append(nodes[ii].getSQL()); } else { assert (ii == 2); assert (m_def.getId() == FunctionId.FUNC_VOLT_REGEXP_POSITION); <START> } <END> } sb.append(Tokens.T_CLOSEBRACKET); return sb.toString(); }</code><technical_language>clear exception is warranted -- is strange inconsistent for FUNC_VOLT_REGEXP_POSITION define extra nodes[] element set null vs. defining element? In other words, this fix works, is a cleaner fix</technical_language>

Target:
public String getSQL() { StringBuffer sb = new StringBuffer(); sb.append(m_def.getName()).append(Tokens.T_OPENBRACKET); switch (m_def.getId()) { case FunctionId.FUNC_VOLT_SINCE_EPOCH: case FunctionId.FUNC_VOLT_TO_TIMESTAMP: case FunctionId.FUNC_VOLT_TRUNCATE_TIMESTAMP: { int timeUnit = ((Number) nodes[0].valueData).intValue(); sb.append(Tokens.getKeyword(timeUnit)); break; } default: sb.append(nodes[0].getSQL()); break; } for (int ii = 1; ii < nodes.length; ii++) { if (nodes[ii] != null) { sb.append(Tokens.T_COMMA).append(nodes[ii].getSQL()); } else { } } sb.append(Tokens.T_CLOSEBRACKET); return sb.toString(); }
Source:
<code>public JFrameTextView(GameController gc){ gc.setView(this); frame = new JFrame("Bomberman"); frame.setLayout(new BorderLayout()); frame.setSize(FRAME_SIZE); textArea = new TextArea(); textArea.setFont(new Font("monospaced", Font.PLAIN, GRID_TEXT_SIZE)); textArea.setEditable(false); frame.add(textArea, BorderLayout.CENTER); console = new TextArea(); <START> console.setSize(FRAME_SIZE.width, FRAME_SIZE.height / 10); <END> console.setEditable(false); frame.add(console, BorderLayout.SOUTH); frame.setVisible(true); }</code><technical_language>Magic number 10</technical_language>

Target:
public JFrameTextView(GameController gc){ gc.setView(this); frame = new JFrame("Bomberman"); frame.setLayout(new BorderLayout()); frame.setSize(FRAME_SIZE); textArea = new TextArea(); textArea.setFont(new Font("monospaced", Font.PLAIN, GRID_TEXT_SIZE)); textArea.setEditable(false); frame.add(textArea, BorderLayout.CENTER); console = new TextArea(); console.setEditable(false); frame.add(console, BorderLayout.SOUTH); frame.setVisible(true); }
Source:
<code>public VDS getValue(S object) { if (object instanceof VDS){ return (VDS) object; } <START> if (object instanceof PairQueryable){ <END> if (((PairQueryable<?, ?>) object).getSecond() instanceof VDS) { return (VDS) ((PairQueryable<?, ?>) object).getSecond(); } } return null; }</code><technical_language>do need this? planning add column SubTabNetworkHostView</technical_language>

Target:
public VDS getValue(S object) { if (object instanceof VDS){ return (VDS) object; } return null; }
Source:
<code>protected void loadMountTableConfigs(URI uri, Configuration conf) throws IOException { String mountTableConfigPath = conf.get(Constants.CONFIG_VIEWFS_MOUNTTABLE_PATH); if (null != mountTableConfigPath) { MountTableConfigLoader loader = new HCFSMountTableConfigLoader(); loader.load(mountTableConfigPath, conf); } else { if (LOG.isDebugEnabled()) { LOG.debug( <START> "Missing configuration for fs.viewfs.mounttable.path. Proceeding" <END> + "with core-site.xml mount-table information if avaialable."); } } }</code><technical_language>avaialable -> available. ( mistake, typo in Original class :-) )</technical_language>

Target:
protected void loadMountTableConfigs(URI uri, Configuration conf) throws IOException { String mountTableConfigPath = conf.get(Constants.CONFIG_VIEWFS_MOUNTTABLE_PATH); if (null != mountTableConfigPath) { MountTableConfigLoader loader = new HCFSMountTableConfigLoader(); loader.load(mountTableConfigPath, conf); } else { if (LOG.isDebugEnabled()) { LOG.debug( "Missing configuration for fs.viewfs.mounttable.path. Proceeding" + "with core-site.xml mount-table information if available."); } } }
Source:
<code>public ContentRetriever instantiate(Map<String, String> parameters) { <START> try { return new ClasspathContentRetriever(); } catch (IOException e) { throw new RuntimeException(e); } <END> }</code><technical_language>IDE exception is thrown ClasspathContentRetriever constructor, remove throws clause remove try-catch block here</technical_language>

Target:
public ContentRetriever instantiate(Map<String, String> parameters) { return new ClasspathContentRetriever(); }
Source:
<code>public void testAddOperationWithCredentialReferenceWithClearTextOnly() throws Exception { try { String password = "secret"; addKeyStoreWithCredentialReference(KS_NAME, null, null, "secret", false, false); assertEquals(password, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); <START> assertEquals(null, readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); <END> } finally { removeKeyStore(KS_NAME); } }</code><technical_language>simplified assertNull</technical_language>

Target:
public void testAddOperationWithCredentialReferenceWithClearTextOnly() throws Exception { try { String password = "secret"; addKeyStoreWithCredentialReference(KS_NAME, null, null, password, false, false); assertEquals(password, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertNull(readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }
Source:
<code>public List<ERepositoryObjectType> getTypes() { <START> List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>(); <END> toReturn.add(ERepositoryObjectType.PROCESS); return toReturn; }</code><technical_language>if lamda expressions diamond operators available)</technical_language>

Target:
public List<ERepositoryObjectType> getTypes() { List<ERepositoryObjectType> toReturn = new ArrayList<>(); toReturn.add(ERepositoryObjectType.PROCESS); return toReturn; }
Source:
<code>public void testInitMissingMaster() throws Exception { selectProject(PROJ1); clickInit(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, repository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); <START> assertNotNull(repository.findRef(Constants.R_HEADS <END> + DEVELOP_BRANCH)); }</code><technical_language>exactRef</technical_language>

Target:
public void testInitMissingMaster() throws Exception { selectProject(PROJ1); clickInit(); fillDialog(MASTER_BRANCH_MISSING); bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing)); bot.button("Yes").click(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); GitFlowRepository gitFlowRepository = new GitFlowRepository(repository); GitFlowConfig config = gitFlowRepository.getConfig(); assertEquals(DEVELOP_BRANCH, repository.getBranch()); assertEquals(MASTER_BRANCH_MISSING, config.getMaster()); assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix()); assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix()); assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix()); assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix()); assertNotNull(repository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH)); }
Source:
<code>private SetupInfo setup(String tableName, String indexName, String columns, String indexColumns, String pk, String includeColumns) throws Exception{ <START> Connection conn = DriverManager.getConnection(getUrl()); <END> String fullTableName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""),SchemaUtil.normalizeIdentifier(tableName)); String fullIndexName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""),SchemaUtil.normalizeIdentifier(indexName)); String str1 = String.format("CREATE TABLE %1$s (%2$s CONSTRAINT pk PRIMARY KEY (%3$s)) COLUMN_ENCODED_BYTES=0", fullTableName, columns, pk); conn.createStatement().execute(str1); String str2 = String.format("CREATE INDEX %1$s ON %2$s (%3$s)", fullIndexName, fullTableName, indexColumns); if (!includeColumns.isEmpty()) str2 += " INCLUDE (" + includeColumns + ")"; conn.createStatement().execute(str2); PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); PTable pIndexTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullIndexName)); PTable pDataTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullTableName)); IndexMaintainer im = pIndexTable.getIndexMaintainer(pDataTable,pconn); SetupInfo info = new SetupInfo(); info.indexMaintainer = im; info.pDataTable = pDataTable; return info; }</code><technical_language>try-with-resources while connection avoid connection leaks</technical_language>

Target:
private SetupInfo setup(String tableName, String indexName, String columns, String indexColumns, String pk, String includeColumns) throws Exception { try(Connection conn = DriverManager.getConnection(getUrl())) { String fullTableName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""), SchemaUtil.normalizeIdentifier(tableName)); String fullIndexName = SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(""), SchemaUtil.normalizeIdentifier(indexName)); String str1 = String.format("CREATE TABLE %1$s (%2$s CONSTRAINT pk PRIMARY KEY (%3$s)) COLUMN_ENCODED_BYTES=0", fullTableName, columns, pk); conn.createStatement().execute(str1); String str2 = String.format("CREATE INDEX %1$s ON %2$s (%3$s)", fullIndexName, fullTableName, indexColumns); if (!includeColumns.isEmpty()) str2 += " INCLUDE (" + includeColumns + ")"; conn.createStatement().execute(str2); PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class); PTable pIndexTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullIndexName)); PTable pDataTable = pconn.getTable(new PTableKey(pconn.getTenantId(), fullTableName)); IndexMaintainer im = pIndexTable.getIndexMaintainer(pDataTable, pconn); SetupInfo info = new SetupInfo(); info.indexMaintainer = im; info.pDataTable = pDataTable; return info; } }
Source:
<code>public PhoenixResultSet executeQuery() throws SQLException { <START> throw new SQLExceptionInfo.Builder(SQLExceptionCodeEnum.INTERNAL_ERROR) <END> .setMessage("executeQuery may not be used for delete: " + this).build().buildException(); }</code><technical_language>same. fine if message</technical_language>

Target:
public PhoenixResultSet executeQuery() throws SQLException { throw new ExecuteQueryNotApplicableException("delete", this.toString()); }
Source:
<code>protected boolean moveToState(STATE to) { if (state.get() == to) { <START> return false; <END> } return moveToState(state.get(), to); }</code><technical_language>is contract for return of this method? If state move to, moveToState is successful (i.e. true)</technical_language>

Target:
protected void moveToState(STATE to) { if (state.get() != to) { moveToState(state.get(), to); } }
Source:
<code>public void testShellExecuteEx() { try { File f = createTempFile(); f.deleteOnExit(); SHELLEXECUTEINFO lpExecInfo = new SHELLEXECUTEINFO(); lpExecInfo.lpVerb = new WString("0p3n"); lpExecInfo.nShow = User32.SW_SHOWDEFAULT; lpExecInfo.fMask = Shell32.SEE_MASK_NOCLOSEPROCESS | Shell32.SEE_MASK_FLAG_NO_UI; lpExecInfo.lpFile = new WString(f.getAbsolutePath()); assertFalse(Shell32.INSTANCE.ShellExecuteEx(lpExecInfo)); assertTrue(Native.getLastError() == W32Errors.ERROR_NO_ASSOCIATION); } catch (Exception e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>java throw new RuntimeException(e); // cause..</technical_language>

Target:
public void testShellExecuteEx() { File file = new File(System.getProperty("java.io.tmpdir"), System.nanoTime() + ".txt"); try { try { fillTempFile(file); } catch (IOException e) { throw new RuntimeException(e); } SHELLEXECUTEINFO lpExecInfo = new SHELLEXECUTEINFO(); lpExecInfo.lpVerb = "0p3n"; lpExecInfo.nShow = User32.SW_SHOWDEFAULT; lpExecInfo.fMask = Shell32.SEE_MASK_NOCLOSEPROCESS | Shell32.SEE_MASK_FLAG_NO_UI; lpExecInfo.lpFile = file.getAbsolutePath(); assertFalse("ShellExecuteEx should have returned false - action verb was bogus.", Shell32.INSTANCE.ShellExecuteEx(lpExecInfo)); assertEquals("GetLastError() should have been set to ERROR_NO_ASSOCIATION because of bogus action", W32Errors.ERROR_NO_ASSOCIATION, Native.getLastError()); } finally { if (file.exists()) { file.delete(); } } }
Source:
<code>public void canDisableVirtioScsiFail() { Disk disk = new DiskImage(); DiskVmElement dve = new DiskVmElement(disk.getId(), vm.getId()); dve.setDiskInterface(DiskInterface.VirtIO_SCSI); disk.setDiskVmElements(Collections.singletonList(dve)); <START> when(DbFacade.getInstance().getVmNetworkInterfaceDao()).thenReturn(vmNetworkInterfaceDao); <END> assertThat(validator.canDisableVirtioScsi(Collections.singletonList(disk)), failsWith(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS)); }</code><technical_language>huh</technical_language>

Target:
public void canDisableVirtioScsiFail() { Disk disk = new DiskImage(); DiskVmElement dve = new DiskVmElement(disk.getId(), vm.getId()); dve.setDiskInterface(DiskInterface.VirtIO_SCSI); disk.setDiskVmElements(Collections.singletonList(dve)); assertThat(validator.canDisableVirtioScsi(Collections.singletonList(disk)), failsWith(EngineMessage.CANNOT_DISABLE_VIRTIO_SCSI_PLUGGED_DISKS)); }
Source:
<code>private FieldSearchFilter[] createSearchFilters(String type, RestListRequest requestList) { List<FieldSearchFilter> filters = new ArrayList<>(); filters.add( new FieldSearchFilter(IResourceManager.RESOURCE_TYPE_FILTER_KEY, type, false) ); for (Filter filter : Optional.ofNullable(requestList.getFilters()).orElse(new Filter[]{})) { String attr; boolean useLikeOption = false; switch (filter.getAttribute()) { case "name": attr = IResourceManager.RESOURCE_FILENAME_FILTER_KEY; useLikeOption = true; break; case "description": attr = IResourceManager.RESOURCE_DESCR_FILTER_KEY; useLikeOption = true; break; case "createdAt": attr = IResourceManager.RESOURCE_CREATION_DATE_FILTER_KEY; break; case "updatedAt": attr = IResourceManager.RESOURCE_MODIFY_DATE_FILTER_KEY; break; case "group": attr = IResourceManager.RESOURCE_MAIN_GROUP_FILTER_KEY; break; <START> default: <END> continue; } filters.add( new FieldSearchFilter(attr, filter.getValue(), useLikeOption) ); } filters.add(createOrderFilter(requestList)); return filters.stream().toArray(FieldSearchFilter[]::new); }</code><technical_language>Is this error condition? get logged a minimum i</technical_language>

Target:
private FieldSearchFilter[] createSearchFilters(String type, RestListRequest requestList) { List<FieldSearchFilter> filters = new ArrayList<>(); filters.add( new FieldSearchFilter(IResourceManager.RESOURCE_TYPE_FILTER_KEY, type, false) ); for (Filter filter : Optional.ofNullable(requestList.getFilters()).orElse(new Filter[]{})) { String attr; boolean useLikeOption = false; switch (filter.getAttribute()) { case "name": attr = IResourceManager.RESOURCE_FILENAME_FILTER_KEY; useLikeOption = true; break; case "description": attr = IResourceManager.RESOURCE_DESCR_FILTER_KEY; useLikeOption = true; break; case "createdAt": attr = IResourceManager.RESOURCE_CREATION_DATE_FILTER_KEY; break; case "updatedAt": attr = IResourceManager.RESOURCE_MODIFY_DATE_FILTER_KEY; break; case "group": attr = IResourceManager.RESOURCE_MAIN_GROUP_FILTER_KEY; break; default: log.warn("Invalid filter attribute: " + filter.getAttribute()); continue; } filters.add( new FieldSearchFilter(attr, filter.getValue(), useLikeOption) ); } filters.add(createOrderFilter(requestList)); return filters.stream().toArray(FieldSearchFilter[]::new); }
Source:
<code>public void testErrorPrecedenceWithBlobDeletedAndExpiredCase() throws Exception { doPut(); <START> ServerErrorCode[] serverErrorCodesToTest = {ServerErrorCode.Blob_Deleted, ServerErrorCode.Blob_Expired}; <END> RouterErrorCode[] routerErrorCodesToExpect = {RouterErrorCode.BlobDeleted, RouterErrorCode.BlobExpired}; for (int i = 0; i < serverErrorCodesToTest.length; i++) { int indexToSetCustomError = random.nextInt(replicasCount); ServerErrorCode[] serverErrorCodesInOrder = new ServerErrorCode[9]; for (int j = 0; j < serverErrorCodesInOrder.length; j++) { if (j == indexToSetCustomError) { serverErrorCodesInOrder[j] = serverErrorCodesToTest[i]; } else { serverErrorCodesInOrder[j] = ServerErrorCode.Blob_Not_Found; } } testErrorPrecedence(serverErrorCodesInOrder, routerErrorCodesToExpect[i]); } }</code><technical_language>Defining arrays is apparent of mapping. a map of server error code router error code intuitive</technical_language>

Target:
public void testErrorPrecedenceWithBlobDeletedAndExpiredCase() throws Exception { doPut(); Map<ServerErrorCode, RouterErrorCode> serverErrorToRouterError = new HashMap<>(); serverErrorToRouterError.put(ServerErrorCode.Blob_Deleted, RouterErrorCode.BlobDeleted); serverErrorToRouterError.put(ServerErrorCode.Blob_Expired, RouterErrorCode.BlobExpired); for (Map.Entry<ServerErrorCode, RouterErrorCode> entry : serverErrorToRouterError.entrySet()) { int indexToSetCustomError = random.nextInt(replicasCount); ServerErrorCode[] serverErrorCodesInOrder = new ServerErrorCode[9]; for (int j = 0; j < serverErrorCodesInOrder.length; j++) { if (j == indexToSetCustomError) { serverErrorCodesInOrder[j] = entry.getKey(); } else { serverErrorCodesInOrder[j] = ServerErrorCode.Blob_Not_Found; } } testErrorPrecedence(serverErrorCodesInOrder, entry.getValue()); } }
Source:
<code>protected ExpectedBehaviour getExpectedBehaviour() { if (!excNumberDefined) return ExpectedBehaviour.ANY_EXCEPTION; <START> return ExpectedBehaviour.SPECIFIC_EXCEPTION; <END> }</code><technical_language>simplify a bit? fit in a single 1-line operator</technical_language>

Target:
protected ExpectedBehaviour getExpectedBehaviour() { return excNumberDefined ? SPECIFIC_EXCEPTION : ANY_EXCEPTION; }