auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testConnectAnnotationsStringAnalyze() { for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz, 3zzz,4zzz,5zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz,20zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Modify_Code"); annotationOne.setIsAnalyze(true); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 13); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 5) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else if (i < 12) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 5]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), id20); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_Analyzed, actual); }

Target:
public void testConnectAnnotationsStringAnalyze() { for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } int idsSize = 13; DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz, 3zzz,4zzz,5zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz,20zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Modify_Code"); annotationOne.setIsAnalyze(true); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == idsSize); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 5) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else if (i < 12) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 5]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), id20); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_Analyzed, actual); }
Source:
protected boolean stepNodeTree(TaggedValuePointable tvpInput, int level, IPointable result) throws AlgebricksException { if (level + 1 > indexSequence.size()) { indexSequence.add(0); returnSequence.add(0); } SequencePointable seqItem = pp.takeOne(SequencePointable.class); try { getSequence(tvpInput, seqItem); int seqLength = seqItem.getEntryCount(); while (indexSequence.get(level) < seqLength) { seqItem.getEntry(indexSequence.get(level), tvpItem); if (indexSequence.get(level) == returnSequence.get(level)) { returnSequence.set(level, returnSequence.get(level) + 1); if (isfilter) { if (filter.accept(ntp, tvpItem)) { try { setNodeToResult(tvpItem, result); return true; } catch (IOException e) { String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription(); throw new AlgebricksException(description); } } else { setNodeToResult(tvpItem, result); continue; } } else { setNodeToResult(tvpItem, result); return true; } } if (level + 1 <= indexSequence.size()) { if (stepNodeTree(tvpItem, level + 1, result)) { return true; } } indexSequence.set(level, indexSequence.get(level) + 1); } if (level == 0) { indexSequence.set(level, 0); returnSequence.set(level, 0); } else { indexSequence.remove(level); returnSequence.remove(level); } return false; } catch (IOException e) { String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription(); throw new AlgebricksException(description); } finally { pp.giveBack(seqItem); } }

Target:
protected boolean stepNodeTree(TaggedValuePointable tvpInput, int level, IPointable result) throws AlgebricksException { if (level + 1 > indexSequence.size()) { indexSequence.add(0); returnSequence.add(0); } SequencePointable seqItem = pp.takeOne(SequencePointable.class); try { getSequence(tvpInput, seqItem); int seqLength = seqItem.getEntryCount(); while (indexSequence.get(level) < seqLength) { seqItem.getEntry(indexSequence.get(level), tvpItem); if (indexSequence.get(level) == returnSequence.get(level)) { returnSequence.set(level, returnSequence.get(level) + 1); if (!isfilter || (isfilter && filter.accept(ntp, tvpItem))) { setNodeToResult(tvpItem, result); return true; } } if (level + 1 <= indexSequence.size()) { if (stepNodeTree(tvpItem, level + 1, result)) { return true; } } indexSequence.set(level, indexSequence.get(level) + 1); } if (level == 0) { indexSequence.set(level, 0); returnSequence.set(level, 0); } else { indexSequence.remove(level); returnSequence.remove(level); } return false; } catch (IOException e) { String description = ErrorCode.SYSE0001 + ": " + ErrorCode.SYSE0001.getDescription(); throw new AlgebricksException(description); } finally { pp.giveBack(seqItem); } }
Source:
protected List<SPMAsyncTaskHandler> initTaskHandlers() { List<SPMAsyncTaskHandler> taskHandlers = new ArrayList<>(); if (!getParameters().isImageIdsSorted()) { List<DiskImage> images = getAllImagesForDisk(); ImagesHandler.sortImageList(images); List<DiskImage> sortedImages = images.stream() .filter(image -> getImages().contains(image)) .filter(image -> image.getDiskStorageType() == DiskStorageType.IMAGE) .collect(Collectors.toList()); getParameters().setImageIds(new ArrayList<>(ImagesHandler.getDiskImageIds(sortedImages))); getParameters().setImageIdsSorted(true); } for (Guid imageId : getParameters().getImageIds()) { taskHandlers.add(new RemoveDiskSnapshotTaskHandler(this, imageId, getImageGroupId(), getVmId())); } return !taskHandlers.isEmpty() ? taskHandlers : null; }

Target:
protected List<SPMAsyncTaskHandler> initTaskHandlers() { List<SPMAsyncTaskHandler> taskHandlers = new ArrayList<>(); if (!getParameters().isImageIdsSorted()) { List<DiskImage> images = getAllImagesForDisk(); ImagesHandler.sortImageList(images); List<DiskImage> sortedImages = images.stream() .filter(image -> image.getDiskStorageType() == DiskStorageType.IMAGE) .filter(image -> getImages().contains(image)) .collect(Collectors.toList()); getParameters().setImageIds(new ArrayList<>(ImagesHandler.getDiskImageIds(sortedImages))); getParameters().setImageIdsSorted(true); } for (Guid imageId : getParameters().getImageIds()) { taskHandlers.add(new RemoveDiskSnapshotTaskHandler(this, imageId, getImageGroupId(), getVmId())); } return !taskHandlers.isEmpty() ? taskHandlers : null; }
Source:
void add(ChannelOutboundBuffer buffer, boolean connected) throws Exception { processor.connected = connected; try { buffer.forEachFlushedMessage(processor); } finally { processor.connected = false; } }

Target:
void add(ChannelOutboundBuffer buffer, boolean connected) throws Exception { processor.connected = connected; buffer.forEachFlushedMessage(processor); }
Source:
public UrlContent getResourceContent(String sessionId, String url, boolean insecure) throws IOException { CommonHttpClientBuilder builder = new CommonHttpClientBuilder().maxConnections(CONNECTION_POOL_SIZE) .useSystemProperties() .insecure(insecure); try (CloseableHttpClient client = builder.build()) { HttpGet request = new HttpGet(url); if (sessionId != null) { request.setHeader("sessionid", sessionId); } CloseableHttpResponse response = client.execute(request); StatusLine status = response.getStatusLine(); if (status.getStatusCode() != HttpStatus.SC_OK) { throw new IOException(String.format("Cannot access resource %s: code %d", url, status.getStatusCode())); } Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); String filename; if (contentDispositionHeader != null && contentDispositionHeader.getValue().matches(CONTENT_DISPOSITIOB_REGEXP)) { filename = contentDispositionHeader.getValue().replaceFirst(CONTENT_DISPOSITIOB_REGEXP, "$1"); } else { filename = FileUtils.getFileNameWithExtension(new URL(url)); } return new UrlContent(readContent(response.getEntity().getContent()), filename); } }

Target:
public UrlContent getResourceContent(String sessionId, String url, boolean insecure) throws IOException { CommonHttpClientBuilder builder = new CommonHttpClientBuilder().maxConnections(CONNECTION_POOL_SIZE) .useSystemProperties() .insecure(insecure); try (CloseableHttpClient client = builder.build()) { CloseableHttpResponse response = createAndExecuteRequest(sessionId, url, client); Header contentDispositionHeader = response.getFirstHeader("Content-Disposition"); String filename; if (contentDispositionHeader != null && contentDispositionHeader.getValue().matches(CONTENT_DISPOSITIOB_REGEXP)) { filename = contentDispositionHeader.getValue().replaceFirst(CONTENT_DISPOSITIOB_REGEXP, "$1"); } else { filename = FileUtils.getFileNameWithExtension(new URL(url)); } return new UrlContent(readContent(response.getEntity().getContent()), filename); } }
Source:
public int getEncodeSize() { return 0; }

Target:
public int getEncodeSize() { return getBuffer() == null ? -1 : getBuffer().writerIndex(); }
Source:
public StandardSlackService(StandardSlackServiceBuilder standardSlackServiceBuilder) { this.baseUrl = standardSlackServiceBuilder.baseUrl; if (this.baseUrl != null && !this.baseUrl.isEmpty() && !this.baseUrl.endsWith("/")) { this.baseUrl += "/"; } this.teamDomain = standardSlackServiceBuilder.teamDomain; this.botUser = standardSlackServiceBuilder.botUser; if (standardSlackServiceBuilder.roomId == null) { throw new IllegalArgumentException("Project Channel or Slack User ID must be specified."); } this.roomIds = standardSlackServiceBuilder.roomId.split("[,; ]+"); this.replyBroadcast = standardSlackServiceBuilder.replyBroadcast; this.sendAsText = standardSlackServiceBuilder.sendAsText; this.iconEmoji = correctEmojiFormat(standardSlackServiceBuilder.iconEmoji); this.username = standardSlackServiceBuilder.username; this.populatedToken = standardSlackServiceBuilder.populatedToken; }

Target:
public StandardSlackService(StandardSlackServiceBuilder standardSlackServiceBuilder) { this.baseUrl = standardSlackServiceBuilder.baseUrl; if (this.baseUrl != null && !this.baseUrl.isEmpty() && !this.baseUrl.endsWith("/")) { this.baseUrl += "/"; } this.teamDomain = standardSlackServiceBuilder.teamDomain; this.botUser = standardSlackServiceBuilder.botUser; if (standardSlackServiceBuilder.roomId == null) { throw new IllegalArgumentException("Project Channel or Slack User ID must be specified."); } this.roomIds = standardSlackServiceBuilder.roomId.split("[,; ]+"); this.replyBroadcast = standardSlackServiceBuilder.replyBroadcast; this.iconEmoji = correctEmojiFormat(standardSlackServiceBuilder.iconEmoji); this.username = standardSlackServiceBuilder.username; this.populatedToken = standardSlackServiceBuilder.populatedToken; }
Source:
public void process(AuthToken m, AuthCallbacks.GenericCallback<AuthToken> cb) { try { byte[] clientSideToken = m.getData(); byte[] response = server.response(clientSideToken); if (response != null) { cb.operationComplete(BKException.Code.OK, AuthToken.wrap(response)); } if (server.isComplete()) { completeCb.operationComplete(BKException.Code.OK, null); } } catch (SaslException err) { LOG.error("SASL error", err); completeCb.operationComplete(BKException.Code.UnauthorizedAccessException, null); } }

Target:
public void process(AuthToken m, AuthCallbacks.GenericCallback<AuthToken> cb) { try { byte[] clientSideToken = m.getData(); byte[] response = server.response(clientSideToken); if (response != null) { cb.operationComplete(BKException.Code.OK, AuthToken.wrap(response)); } if (server.isComplete()) { completeCb.operationComplete(BKException.Code.OK, null); } } catch (SaslException err) { LOG.debug("SASL error", err); completeCb.operationComplete(BKException.Code.UnauthorizedAccessException, null); } }
Source:
public CompletionStage<Result> status() { return ask( "/user/status", new StatusActor.StatusRequest(), new StatusResponse.Builder() .setLocalAddress(_actorSystem.provider().getDefaultAddress()) .build()) .thenApply(status -> ok(OBJECT_MAPPER.<JsonNode>valueToTree(status))); }

Target:
public CompletionStage<Result> status() { return PatternsCS.ask( _statusActor, new StatusActor.StatusRequest(), Duration.ofSeconds(1)) .exceptionally(t -> new StatusResponse.Builder() .setLocalAddress(_actorSystem.provider().getDefaultAddress()) .build()) .thenApply(status -> ok(OBJECT_MAPPER.<JsonNode>valueToTree(status))); }
Source:
protected String findOriginalName(String fullpath, String changeset) throws IOException { if (fullpath == null || fullpath.isEmpty() || fullpath.length() < directoryName.length()) { LOGGER.log(Level.SEVERE, "Invalid file path string: {0}", fullpath); return null; } if (changeset == null || changeset.isEmpty()) { LOGGER.log(Level.SEVERE, "Invalid changeset string: {0}", changeset); return null; } String file = fullpath.replace(directoryName + File.separator, ""); String[] argv = { ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK), "log", "--follow", "--summary", ABBREV_LOG, "--abbrev-commit", fullpath }; ProcessBuilder pb = new ProcessBuilder(argv); Process process = Runtime.getRuntime().exec(argv, null, new File(directoryName)); try { try (BufferedReader in = new BufferedReader( new InputStreamReader(process.getInputStream()))) { String line; String rev = null; while ((line = in.readLine()) != null) { if (line.startsWith("commit ")) { rev = line.replace("commit ", ""); continue; } if (rev.equals(changeset)) { break; } if (line.startsWith(" rename ")) { line = line.replace(" rename ", ""); line = expandGitRenamedOutput(line); String[] split = line.split(" => "); if (split.length < 2) { throw new IOException( String.format( "Invalid format of the git output. Expected " + "\"file => otherfile\" but got \"{}\"", line)); } file = split[0]; } if (rev.equals(changeset)) { break; } } } } finally { if (process != null) { try { process.exitValue(); } catch (IllegalThreadStateException e) { process.destroy(); } } } return (fullpath.substring(0, directoryName.length() + 1) + file); }

Target:
protected String findOriginalName(String fullpath, String changeset) throws IOException { if (fullpath == null || fullpath.isEmpty() || fullpath.length() < directoryName.length()) { throw new IOException(String.format("Invalid file path string: %s", fullpath)); } if (changeset == null || changeset.isEmpty()) { throw new IOException(String.format("Invalid changeset string for path %s: %s", fullpath, changeset)); } String file = fullpath.replace(directoryName + File.separator, ""); String[] argv = { ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK), "log", "--follow", "--summary", ABBREV_LOG, "--abbrev-commit", "--name-status", "--pretty=format:commit %h%b", "--", fullpath }; ProcessBuilder pb = new ProcessBuilder(argv); Process process = Runtime.getRuntime().exec(argv, null, new File(directoryName)); try { try (BufferedReader in = new BufferedReader( new InputStreamReader(process.getInputStream()))) { String line; String rev = null; Matcher m; Pattern pattern = Pattern.compile("^R\\d+\\s(.*)\\s(.*)"); while ((line = in.readLine()) != null) { if (line.startsWith("commit ")) { rev = line.substring(7); continue; } if (changeset.equals(rev)) { break; } if ((m = pattern.matcher(line)).find()) { file = m.group(1); } } } } finally { if (process != null) { try { process.exitValue(); } catch (IllegalThreadStateException e) { process.destroy(); } } } return (fullpath.substring(0, directoryName.length() + 1) + file); }
Source:
public AbstractDiskModel() { setSizeExtend(new EntityModel()); getSizeExtend().setEntity(String.valueOf(0)); setIsAttachDisk(new EntityModel()); getIsAttachDisk().setEntity(false); getIsAttachDisk().getEntityChangedEvent().addListener(this); setIsInternal(new EntityModel()); getIsInternal().setEntity(true); getIsInternal().getEntityChangedEvent().addListener(this); setIsWipeAfterDelete(new EntityModel()); getIsWipeAfterDelete().setEntity(false); getIsWipeAfterDelete().getEntityChangedEvent().addListener(this); setIsBootable(new EntityModel()); getIsBootable().setEntity(false); setIsShareable(new EntityModel()); getIsShareable().setEntity(false); setIsPlugged(new EntityModel()); getIsPlugged().setEntity(true); setIsDirectLunDiskAvaialable(new EntityModel()); getIsDirectLunDiskAvaialable().setEntity(true); setDataCenter(new ListModel()); getDataCenter().setIsAvailable(false); getDataCenter().getSelectedItemChangedEvent().addListener(this); setStorageType(new ListModel()); getStorageType().setIsAvailable(false); getStorageType().setItems(AsyncDataProvider.getStorageTypeList()); getStorageType().getSelectedItemChangedEvent().addListener(this); setHost(new ListModel()); getHost().setIsAvailable(false); getVolumeType().getSelectedItemChangedEvent().addListener(this); setInternalAttachableDisks(new ListModel()); setExternalAttachableDisks(new ListModel()); }

Target:
public AbstractDiskModel() { setSizeExtend(new EntityModel()); getSizeExtend().setEntity(0); setIsAttachDisk(new EntityModel()); getIsAttachDisk().setEntity(false); getIsAttachDisk().getEntityChangedEvent().addListener(this); setIsInternal(new EntityModel()); getIsInternal().setEntity(true); getIsInternal().getEntityChangedEvent().addListener(this); setIsWipeAfterDelete(new EntityModel()); getIsWipeAfterDelete().setEntity(false); getIsWipeAfterDelete().getEntityChangedEvent().addListener(this); setIsBootable(new EntityModel()); getIsBootable().setEntity(false); setIsShareable(new EntityModel()); getIsShareable().setEntity(false); setIsPlugged(new EntityModel()); getIsPlugged().setEntity(true); setIsDirectLunDiskAvaialable(new EntityModel()); getIsDirectLunDiskAvaialable().setEntity(true); setDataCenter(new ListModel()); getDataCenter().setIsAvailable(false); getDataCenter().getSelectedItemChangedEvent().addListener(this); setStorageType(new ListModel()); getStorageType().setIsAvailable(false); getStorageType().setItems(AsyncDataProvider.getStorageTypeList()); getStorageType().getSelectedItemChangedEvent().addListener(this); setHost(new ListModel()); getHost().setIsAvailable(false); getVolumeType().getSelectedItemChangedEvent().addListener(this); setInternalAttachableDisks(new ListModel()); setExternalAttachableDisks(new ListModel()); }
Source:
public HashSet<String> getAssumeUnchanged() { return assumeUnchanged; }

Target:
public Set<String> getAssumeUnchanged() { return assumeUnchanged; }
Source:
public static String forChipset(String emulatedMachine, ChipsetType chipsetType) { return ClusterEmulatedMachines.parse(emulatedMachine).getForChipset(chipsetType); }

Target:
public static String forChipset(String emulatedMachine, ChipsetType chipsetType) { return ClusterEmulatedMachines.parse(emulatedMachine).getTypeByChipset(chipsetType); }
Source:
public Collection<TTSService> getTTSs() { return Collections.unmodifiableCollection(ttsServices.values()); }

Target:
public Collection<TTSService> getTTSs() { return new HashSet<>(ttsServices.values()); }
Source:
static OldDataMonitor get(Jenkins j) throws IllegalStateException { AdministrativeMonitor monitor = j.getAdministrativeMonitor("OldData"); if (monitor == null) { throw new IllegalStateException("Cannot find OldData administrative monitor"); } else if (!(monitor instanceof OldDataMonitor)) { throw new IllegalStateException("Wrong type of the OldData administrative monitor. Got: " + monitor.getClass()); } return (OldDataMonitor)monitor; }

Target:
static OldDataMonitor get(Jenkins j) throws IllegalStateException { return ExtensionList.lookupSingleton(OldDataMonitor.class); }
Source:
public void shouldLoginWhenUserExists() { when(dao.find(user.getLogin(), user.getPassword())).thenReturn(user); controller.login(user.getLogin(), user.getPassword()); assertFalse(validator.hasErrors()); }

Target:
public void shouldLoginWhenUserExists() { when(dao.find(user.getLogin(), user.getPassword())).thenReturn(user); controller.login(user.getLogin(), user.getPassword()); assertThat(validator.getErrors(), empty()); }
Source:
public void testGetFolderContentWithInvalidIdentifier() throws Exception { final String NOT_EXISTING_ID = "01234567-1234-1234-1234-123456789012"; try { browserAPI.getFolderContent( APILocator.systemUser(), NOT_EXISTING_ID, 0, -1, "", null, null, true, false, false, false, "", false, false, 1 ); } catch ( Exception e ){ Assert.assertTrue( e instanceof NotFoundInDbException ); } }

Target:
public void testGetFolderContentWithInvalidIdentifier() { final String NOT_EXISTING_ID = "01234567-1234-1234-1234-123456789012"; try { browserAPI.getFolderContent( APILocator.systemUser(), NOT_EXISTING_ID, 0, -1, "", null, null, true, false, false, false, "", false, false, 1 ); } catch ( Exception e ){ Assert.assertTrue( e instanceof NotFoundInDbException ); } }
Source:
protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> callback, CreateVolumeFromBaseImageContext<VolumeApiResult> context) { CopyCommandResult result = callback.getResult(); VolumeInfo volume = (VolumeInfo)context.templateOnStore; SnapshotInfo snapshot = context.snapshot; VolumeApiResult apiResult = new VolumeApiResult(volume); Event event = null; if (result.isFailed()) { apiResult.setResult(result.getResult()); event = Event.OperationFailed; } else { event = Event.OperationSuccessed; } try { if (result.isSuccess()) { volume.processEvent(event, result.getAnswer()); } else { volume.processEvent(event); } VolumeDetailVO volumeDetailVO = _volumeDetailsDao.findDetail(volume.getId(),"SNAPSHOT_ID"); _volumeDetailsDao.remove(volumeDetailVO.getId()); } catch (Exception e) { s_logger.debug("create volume from snapshot failed", e); apiResult.setResult(e.toString()); } AsyncCallFuture<VolumeApiResult> future = context.future; future.complete(apiResult); return null; }

Target:
protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> callback, CreateVolumeFromBaseImageContext<VolumeApiResult> context) { CopyCommandResult result = callback.getResult(); VolumeInfo volume = (VolumeInfo)context.templateOnStore; SnapshotInfo snapshot = context.snapshot; VolumeApiResult apiResult = new VolumeApiResult(volume); Event event = null; if (result.isFailed()) { apiResult.setResult(result.getResult()); event = Event.OperationFailed; } else { event = Event.OperationSuccessed; } try { if (result.isSuccess()) { volume.processEvent(event, result.getAnswer()); } else { volume.processEvent(event); } _volumeDetailsDao.removeDetail(volume.getId(), SNAPSHOT_ID); } catch (Exception e) { s_logger.debug("create volume from snapshot failed", e); apiResult.setResult(e.toString()); } AsyncCallFuture<VolumeApiResult> future = context.future; future.complete(apiResult); return null; }
Source:
protected Control createDialogArea(Composite parent) { getShell().setText(fShellTitle); Composite composite = (Composite)super.createDialogArea(parent); Composite innerComposite = new Composite(composite, SWT.NONE); innerComposite.setLayoutData(new GridData()); GridLayout gl= new GridLayout(); gl.numColumns= 2; innerComposite.setLayout(gl); Label label= new Label(innerComposite, SWT.NONE); label.setText(fLabelText); label.setLayoutData(new GridData()); final Combo combo= new Combo(innerComposite, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(combo); for (String fAllowedString : fAllowedStrings) { combo.add(fAllowedString); } combo.select(fInitialSelectionIndex); fSelection= combo.getItem(combo.getSelectionIndex()); GridData gd= new GridData(); gd.widthHint= convertWidthInCharsToPixels(getMaxStringLength()); combo.setLayoutData(gd); combo.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected(SelectionEvent e) { fSelection= combo.getItem(combo.getSelectionIndex()); } }); applyDialogFont(composite); return composite; }

Target:
protected Control createDialogArea(Composite parent) { getShell().setText(fShellTitle); Composite composite = (Composite)super.createDialogArea(parent); Composite innerComposite = new Composite(composite, SWT.NONE); innerComposite.setLayoutData(new GridData()); GridLayout gl= new GridLayout(); gl.numColumns= 2; innerComposite.setLayout(gl); Label label= new Label(innerComposite, SWT.NONE); label.setText(fLabelText); label.setLayoutData(new GridData()); final Combo combo= new Combo(innerComposite, SWT.READ_ONLY); SWTUtil.setDefaultVisibleItemCount(combo); for (String allowedString : fAllowedStrings) { combo.add(allowedString); } combo.select(fInitialSelectionIndex); fSelection= combo.getItem(combo.getSelectionIndex()); GridData gd= new GridData(); gd.widthHint= convertWidthInCharsToPixels(getMaxStringLength()); combo.setLayoutData(gd); combo.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected(SelectionEvent e) { fSelection= combo.getItem(combo.getSelectionIndex()); } }); applyDialogFont(composite); return composite; }
Source:
protected void onInitUI() { super.onInitUI(); table = new ChangeTable(true); byOwner = new ChangeTable.Section("", ChangeTable.ApprovalViewType.STRONGEST); forReview = new ChangeTable.Section("", ChangeTable.ApprovalViewType.MINE); closed = new ChangeTable.Section("", ChangeTable.ApprovalViewType.STRONGEST); table.addSection(byOwner); table.addSection(forReview); table.addSection(closed); add(table); table.setSavePointerId(Link.toAccountDashboard(ownerId)); }

Target:
protected void onInitUI() { super.onInitUI(); table = new ChangeTable(true); byOwner = new ChangeTable.Section("", ApprovalViewType.STRONGEST, null); forReview = new ChangeTable.Section("", ApprovalViewType.USER, ownerId); closed = new ChangeTable.Section("", ApprovalViewType.STRONGEST, null); table.addSection(byOwner); table.addSection(forReview); table.addSection(closed); add(table); table.setSavePointerId(Link.toAccountDashboard(ownerId)); }
Source:
void scrollToSection(@NonNull String sectionAnchor) { bridge.execute(JavaScriptActionHandler.prepareToScrollTo(sectionAnchor, "{ highlight: false }")); for (Section section : adapter.sections) { if (section.getAnchor().equals(sectionAnchor)) { scrollToSection(section); break; } } }

Target:
void scrollToSection(@NonNull String sectionAnchor) { bridge.execute(JavaScriptActionHandler.prepareToScrollTo(sectionAnchor, "{ highlight: false }")); }
Source:
private void createTable(TableName tableName) throws Exception { HTableDescriptor desc = new HTableDescriptor(tableName); HColumnDescriptor familyDesc = new HColumnDescriptor(FAMILY); familyDesc.setScope(HConstants.REPLICATION_SCOPE_GLOBAL); desc.addFamily(familyDesc); admin1.createTable(desc); admin2.createTable(desc); utility1.waitUntilAllRegionsAssigned(tableName); utility2.waitUntilAllRegionsAssigned(tableName); }

Target:
private void createTable(TableName tableName) throws Exception { TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName).setColumnFamily( ColumnFamilyDescriptorBuilder.newBuilder(FAMILY) .setScope(HConstants.REPLICATION_SCOPE_GLOBAL).build() ).build(); admin1.createTable(desc); admin2.createTable(desc); utility1.waitUntilAllRegionsAssigned(tableName); utility2.waitUntilAllRegionsAssigned(tableName); }
Source:
public ArrayList<EventDefinitionCRFBean> validateSubmissionUrl(ArrayList<EventDefinitionCRFBean> edcsInSession, ArrayList<EventDefinitionCRFBean> eventDefCrfList, Validator v, StudyEventDefinitionBean sed) { for (int i = 0; i < edcsInSession.size(); i++) { String order = i + "-" + edcsInSession.get(i).getId(); v.addValidation("submissionUrl" + order, Validator.NO_SPACES_ALLOWED); EventDefinitionCRFBean sessionBean = null; boolean isExist = false; for (EventDefinitionCRFBean eventDef : eventDefCrfList) { sessionBean = edcsInSession.get(i); logger.info("iter: --db: {}", eventDef.getId(), eventDef.getSubmissionUrl()); logger.info("edcsInSession: --session: ", sessionBean.getId(), sessionBean.getSubmissionUrl()); if (sessionBean.getSubmissionUrl().trim().equals("") || sessionBean.getSubmissionUrl().trim() == null) { break; } else { if (eventDef.getSubmissionUrl().trim().equalsIgnoreCase(sessionBean.getSubmissionUrl().trim()) && (eventDef.getId() != sessionBean.getId())) { v.addValidation("submissionUrl" + order, Validator.SUBMISSION_URL_NOT_UNIQUE); sed.setPopulated(true); logger.debug("Duplicate ***************************"); isExist = true; break; } else if (eventDef.getSubmissionUrl().trim().equalsIgnoreCase(sessionBean.getSubmissionUrl().trim()) && (eventDef.getId() == sessionBean.getId())) { logger.debug("Not Duplicate ***********"); isExist = true; break; } } } if (!isExist) { eventDefCrfList.add(sessionBean); } } return eventDefCrfList; }

Target:
public ArrayList<EventDefinitionCRFBean> validateSubmissionUrl(ArrayList<EventDefinitionCRFBean> edcsInSession, ArrayList<EventDefinitionCRFBean> eventDefCrfList, Validator v, StudyEventDefinitionBean sed) { for (int i = 0; i < edcsInSession.size(); i++) { String order = i + "-" + edcsInSession.get(i).getId(); v.addValidation("submissionUrl" + order, Validator.NO_SPACES_ALLOWED); EventDefinitionCRFBean sessionBean = null; boolean isExist = false; for (EventDefinitionCRFBean eventDef : eventDefCrfList) { sessionBean = edcsInSession.get(i); logger.debug("iter: --db: {}", eventDef.getId(), eventDef.getSubmissionUrl()); logger.debug("edcsInSession: --session: ", sessionBean.getId(), sessionBean.getSubmissionUrl()); if (sessionBean.getSubmissionUrl().trim().equals("") || sessionBean.getSubmissionUrl().trim() == null) { break; } else { if (eventDef.getSubmissionUrl().trim().equalsIgnoreCase(sessionBean.getSubmissionUrl().trim()) && (eventDef.getId() != sessionBean.getId())) { v.addValidation("submissionUrl" + order, Validator.SUBMISSION_URL_NOT_UNIQUE); sed.setPopulated(true); logger.debug("Duplicate ***************************"); isExist = true; break; } else if (eventDef.getSubmissionUrl().trim().equalsIgnoreCase(sessionBean.getSubmissionUrl().trim()) && (eventDef.getId() == sessionBean.getId())) { logger.debug("Not Duplicate ***********"); isExist = true; break; } } } if (!isExist) { eventDefCrfList.add(sessionBean); } } return eventDefCrfList; }
Source:
public Authentication authenticate(Authentication authentication) throws AuthenticationException { JWTAuthentication jwtAuthentication = (JWTAuthentication) authentication; String token = jwtAuthentication.getToken(); String userName = securityTokenProvider.getSubject(token); UserDetails user = userDetailsService.loadUserByUsername(userName); Map<String, String> claimMap = new HashMap<>(); claimMap.put("credentials", user.getPassword()); try { securityTokenProvider.verifyToken(token, userName, claimMap); } catch (SecurityTokenException e) { Throwable cause = e.getCause(); if (cause != null && cause instanceof SecurityTokenException) { throw new JwtAuthenticationException(String.format("Invalid JWT: value-[%s]", token), e); } else { throw new BadCredentialsException( String.format(String.format("Credentials don't match: user-[%s] ", userName)), e); } } return authentication; }

Target:
public Authentication authenticate(Authentication authentication) throws AuthenticationException { JWTAuthentication jwtAuthentication = (JWTAuthentication) authentication; String token = jwtAuthentication.getToken(); String userName = securityTokenProvider.getSubject(token); UserDetails user = userDetailsService.loadUserByUsername(userName); Map<String, String> claimMap = new HashMap<>(); claimMap.put("credentials", user.getPassword()); try { securityTokenProvider.verifyToken(token, userName, claimMap); } catch (SecurityTokenException e) { Throwable cause = e.getCause(); if (cause instanceof SecurityTokenException) { throw new JwtAuthenticationException(String.format("Invalid JWT: value-[%s]", token), e); } else { throw new BadCredentialsException( String.format(String.format("Credentials don't match: user-[%s] ", userName)), e); } } return authentication; }
Source:
public void updateVisibility() { messageLabel.setVisible(false); if (ApplicationModeHelper.getUiMode() == ApplicationMode.GlusterOnly) { externalProviderEditor.setVisible(false); neutronPhysicalNetwork.setVisible(false); createSubnetEditor.setVisible(false); vlanTagging.setVisible(false); vlanTag.setVisible(false); exportLabel.setVisible(false); exportEditor.setVisible(false); profilesTab.setVisible(false); } }

Target:
public void updateVisibility() { messageLabel.setVisible(false); if (!ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)) { externalProviderEditor.setVisible(false); neutronPhysicalNetwork.setVisible(false); createSubnetEditor.setVisible(false); vlanTagging.setVisible(false); vlanTag.setVisible(false); exportLabel.setVisible(false); exportEditor.setVisible(false); profilesTab.setVisible(false); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle bundle = getArguments(); courseData = (EnrolledCoursesResponse) bundle .getSerializable(CourseData); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); courseData = (EnrolledCoursesResponse) args.getSerializable(CourseData); if (courseData != null) { isCoursewareAccessible = courseData.getCourse().getCoursewareAccess().hasAccess(); } }
Source:
public int compare(Location o1, Location o2) { return o1.name.compareTo(o2.name); }

Target:
public int compare(Location o1, Location o2) { return ComparisonChain.start().compare(o1.name, o2.name).result(); }
Source:
public void testLimitWithPageAlignment() { List<Page> input = rowPagesBuilder(BIGINT) .addSequencePage(3, 1) .addSequencePage(2, 4) .addSequencePage(2, 6) .build(); OperatorFactory operatorFactory = new LimitOperatorFactory(0, new PlanNodeId("test"), 5); MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT) .page(SequencePageBuilder.createSequencePage(ImmutableList.of(BIGINT), 3, 1)) .page(SequencePageBuilder.createSequencePage(ImmutableList.of(BIGINT), 2, 4)) .build(); OperatorAssertion.assertOperatorEquals(operatorFactory, driverContext, input, expected); }

Target:
public void testLimitWithPageAlignment() { List<Page> input = rowPagesBuilder(BIGINT) .addSequencePage(3, 1) .addSequencePage(2, 4) .addSequencePage(2, 6) .build(); OperatorFactory operatorFactory = new LimitOperatorFactory(0, new PlanNodeId("test"), 5); MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT) .page(createSequencePage(ImmutableList.of(BIGINT), 3, 1)) .page(createSequencePage(ImmutableList.of(BIGINT), 2, 4)) .build(); OperatorAssertion.assertOperatorEquals(operatorFactory, driverContext, input, expected); }
Source:
public String toString() { return "(FOLLOW(" + path + ")" + " AND " + ANY_DIFF + ")"; }

Target:
public String toString() { return "(FOLLOW(" + path + ") AND " + ANY_DIFF + ")"; }
Source:
public Weighting createWeighting( WeightingMap weightingMap, FlagEncoder encoder ) { String weighting = weightingMap.getWeighting().toLowerCase(); if ("shortest".equalsIgnoreCase(weighting)) { return new ShortestWeighting(encoder); } else if ("fastest".equalsIgnoreCase(weighting) || weighting.isEmpty()) { if (encoder.supports(PriorityWeighting.class)) return new PriorityWeighting(encoder, weightingMap); else return new FastestWeighting(encoder, weightingMap); } else if ("curvature".equalsIgnoreCase(weighting) || weighting.isEmpty()) { if (encoder.supports(CurvatureWeighting.class)) return new CurvatureWeighting(encoder, weightingMap, ghStorage); else return new FastestWeighting(encoder, weightingMap); } throw new UnsupportedOperationException("weighting " + weighting + " not supported"); }

Target:
public Weighting createWeighting( WeightingMap weightingMap, FlagEncoder encoder ) { String weighting = weightingMap.getWeighting().toLowerCase(); if ("shortest".equalsIgnoreCase(weighting)) { return new ShortestWeighting(encoder); } else if ("fastest".equalsIgnoreCase(weighting) || weighting.isEmpty()) { if (encoder.supports(PriorityWeighting.class)) return new PriorityWeighting(encoder, weightingMap); else return new FastestWeighting(encoder, weightingMap); } else if ("curvature".equalsIgnoreCase(weighting)) { if (encoder.supports(CurvatureWeighting.class)) return new CurvatureWeighting(encoder, weightingMap, ghStorage); else return new FastestWeighting(encoder, weightingMap); } throw new UnsupportedOperationException("weighting " + weighting + " not supported"); }
Source:
protected void Perform() { if (StringHelper.isNullOrEmpty(mTicket)) { mTicket = Ticketing.GenerateOTP(); } final VM vm = getVm(); final IVdcUser user = getCurrentUser(); vm.setConsoleUserId(user.getUserId()); vm.setguest_cur_user_name(user.getUserName().contains("@") ? user.getUserName() : user.getUserName() + "@" + user.getDomainControler()); final VmDynamicDAO dao = DbFacade.getInstance().getVmDynamicDAO(); if (vm.getAllowConsoleReconnect() || neededPermissions) { dao.update(vm.getDynamicData()); sendTicket(); } else { final boolean saved = dao.updateConsoleUserWithOptimisticLocking(vm.getDynamicData()); if (saved) { sendTicket(); } else { dontSendTicket(); } } }

Target:
protected void Perform() { if (StringHelper.isNullOrEmpty(mTicket)) { mTicket = Ticketing.GenerateOTP(); } final VM vm = getVm(); final IVdcUser user = getCurrentUser(); vm.setConsoleUserId(user.getUserId()); vm.setguest_cur_user_name(user.getFQN()); final VmDynamicDAO dao = DbFacade.getInstance().getVmDynamicDAO(); if (vm.getAllowConsoleReconnect() || neededPermissions) { dao.update(vm.getDynamicData()); sendTicket(); } else { final boolean saved = dao.updateConsoleUserWithOptimisticLocking(vm.getDynamicData()); if (saved) { sendTicket(); } else { dontSendTicket(); } } }
Source:
public void testSimple() { PersistenceTestObject.testMigrate = false; PersistenceTestObject pt = new PersistenceTestObject(); pt.setup(); String ser = SerializerDeserializer.toSerialized(pt, SerializerDeserializer.PERSISTENT); System.out.println(ser); SerializerDeserializer.Deserialized<PersistenceTestObject> deser; deser = SerializerDeserializer.fromSerialized(ser, PersistenceTestObject.class, SerializerDeserializer.PERSISTENT); pt.checkEqual(deser.object); assertFalse(deser.migration.isMigrated()); }

Target:
public void testSimple() { PersistenceTestObject.testMigrate = false; PersistenceTestObject pt = new PersistenceTestObject(); pt.setup(); String ser = SerializerDeserializer.toSerialized(pt, SerializerDeserializer.PERSISTENT); LOGGER.info(ser); SerializerDeserializer.Deserialized<PersistenceTestObject> deser; deser = SerializerDeserializer.fromSerializedPersistent(ser, PersistenceTestObject.class); pt.checkEqual(deser.object); assertFalse(deser.migrated); }
Source:
private void doFilterInternal(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { FirewalledRequest fwRequest = firewall .getFirewalledRequest((HttpServletRequest) request); HttpServletResponse fwResponse = firewall .getFirewalledResponse((HttpServletResponse) response); List<Filter> filters = getFilters(fwRequest); if (filters == null || filters.size() == 0) { if (logger.isDebugEnabled()) { logger.debug(UrlUtils.buildRequestUrl(fwRequest) + (filters == null ? " has no matching filters" : " has an empty filter list")); } fwRequest.reset(); chain.doFilter(fwRequest, fwResponse); return; } VirtualFilterChain vfc = new VirtualFilterChain(fwRequest, chain, filters); vfc.doFilter(fwRequest, fwResponse); } catch (RequestRejectedException e) { requestRejectedHandler.handle((HttpServletRequest) request, (HttpServletResponse) response, e); } }

Target:
private void doFilterInternal(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FirewalledRequest fwRequest = firewall .getFirewalledRequest((HttpServletRequest) request); HttpServletResponse fwResponse = firewall .getFirewalledResponse((HttpServletResponse) response); List<Filter> filters = getFilters(fwRequest); if (filters == null || filters.size() == 0) { if (logger.isDebugEnabled()) { logger.debug(UrlUtils.buildRequestUrl(fwRequest) + (filters == null ? " has no matching filters" : " has an empty filter list")); } fwRequest.reset(); chain.doFilter(fwRequest, fwResponse); return; } VirtualFilterChain vfc = new VirtualFilterChain(fwRequest, chain, filters); vfc.doFilter(fwRequest, fwResponse); }
Source:
public VDS activate() { VDS vds = null; try { log.debugFormat( "Trying to activate host {0} , meanwhile setting status to Unassigned.", getVdsId()); vds = DbFacade.getInstance().getVdsDao().get(getVdsId()); VDSStatus newStatus = refreshCapabilities(new AtomicBoolean(), vds, true); if (log.isDebugEnabled()) { log.debugFormat( "Succeeded to refreshCapabilities for host {0} , new status will be {1} ", getVdsId(), newStatus); } } catch (java.lang.Exception e) { log.infoFormat("Failed to activate VDS = {0} with error: {1}.", getVdsId(), e.getMessage()); } finally { if (vds != null) { UpdateDynamicData(vds.getDynamicData()); monitoringStrategy.processHardwareCapabilities(vds); ResourceManager.getInstance().getEventListener().handleVdsVersion(vds.getId()); } } return vds; }

Target:
public VDS activate() { VDS vds = null; try { log.debugFormat( "Trying to activate host {0} , meanwhile setting status to Unassigned.", getVdsId()); vds = DbFacade.getInstance().getVdsDao().get(getVdsId()); VDSStatus newStatus = refreshCapabilities(new AtomicBoolean(), vds, false); if (log.isDebugEnabled()) { log.debugFormat( "Succeeded to refreshCapabilities for host {0} , new status will be {1} ", getVdsId(), newStatus); } } catch (java.lang.Exception e) { log.infoFormat("Failed to activate VDS = {0} with error: {1}.", getVdsId(), e.getMessage()); } finally { if (vds != null) { UpdateDynamicData(vds.getDynamicData()); monitoringStrategy.processHardwareCapabilities(vds); ResourceManager.getInstance().getEventListener().handleVdsVersion(vds.getId()); } } return vds; }
Source:
private void toolsIdTool() throws Exception { Response response = checkedResponse(basePath + "tools/quay.io%2Ftest_org%2Ftest6"); Tool responseObject = response.readEntity(Tool.class); assertTool(SUPPORT.getObjectMapper().writeValueAsString(responseObject), true); Assert.assertTrue("registry_url should never be null", responseObject.getVersions().size() > 0 && responseObject.getVersions().stream().allMatch(version -> version.getRegistryUrl() != null)); Assert.assertTrue("imageName should never be null", responseObject.getVersions().size() > 0 && responseObject.getVersions().stream().allMatch(version -> version.getImageName() != null)); response = checkedResponse(basePath + "tools?id=quay.io%2Ftest_org%2Ftest6"); List<Tool> responseList = response.readEntity(List.class); assertTool(SUPPORT.getObjectMapper().writeValueAsString(responseList), false); }

Target:
private void toolsIdTool() throws Exception { Response response = checkedResponse(basePath + "tools/quay.io%2Ftest_org%2Ftest6"); Tool responseObject = response.readEntity(Tool.class); assertTool(SUPPORT.getObjectMapper().writeValueAsString(responseObject), true); Assert.assertTrue("registry_url should never be null", responseObject.getVersions().size() > 0 && responseObject.getVersions().stream().allMatch(version -> version.getRegistryUrl() != null)); Assert.assertTrue("imageName should never be null", responseObject.getVersions().size() > 0 && responseObject.getVersions().stream().allMatch(version -> version.getImageName() != null)); response = checkedResponse(basePath + "tools?id=quay.io%2Ftest_org%2Ftest6"); List<Tool> responseList = response.readEntity(List.class); assertTool(SUPPORT.getObjectMapper().writeValueAsString(responseList), true); }
Source:
public boolean extractQuestionDetails( Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { String numOfRubricChoicesString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_COLS); String numOfRubricSubQuestionsString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_ROWS); if (numOfRubricChoicesString == null || numOfRubricSubQuestionsString == null) { return false; } int numOfRubricChoices = Integer.parseInt(numOfRubricChoicesString); int numOfRubricSubQuestions = Integer.parseInt(numOfRubricSubQuestionsString); List<String> rubricChoices = new ArrayList<String>(); List<String> rubricSubQuestions = new ArrayList<String>(); List<List<String>> rubricDescriptions = new ArrayList<List<String>>(); rubricChoices = getRubricChoices(requestParameters, numOfRubricChoices); int numActualChoices = rubricChoices.size(); rubricSubQuestions = getSubQuestions(requestParameters, numOfRubricSubQuestions); int numActualSubQuestions = rubricSubQuestions.size(); rubricDescriptions = getRubricQuestionDescriptions(requestParameters, numOfRubricChoices, numOfRubricSubQuestions); setRubricQuestionDetails(numActualChoices, rubricChoices, numActualSubQuestions, rubricSubQuestions, rubricDescriptions); if (!this.isValidDescriptionSize()) { this.initializeRubricDescriptions(); } return true; }

Target:
public boolean extractQuestionDetails( Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { String numOfRubricChoicesString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_COLS); String numOfRubricSubQuestionsString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_ROWS); if (numOfRubricChoicesString == null || numOfRubricSubQuestionsString == null) { return false; } int numOfRubricChoices = Integer.parseInt(numOfRubricChoicesString); int numOfRubricSubQuestions = Integer.parseInt(numOfRubricSubQuestionsString); List<String> rubricChoices = getRubricChoices(requestParameters, numOfRubricChoices); List<String> rubricSubQuestions = getSubQuestions(requestParameters, numOfRubricSubQuestions); List<List<String>> rubricDescriptions = getRubricQuestionDescriptions(requestParameters, numOfRubricChoices, numOfRubricSubQuestions); setRubricQuestionDetails(rubricChoices, rubricSubQuestions, rubricDescriptions); if (!this.isValidDescriptionSize()) { this.initializeRubricDescriptions(); } return true; }
Source:
public void rowHistoryIsReadyCorrectly() throws Exception { new TableCreator(conn) .withCreate("create table P(col1 int, col2 varchar(2), col3 int, col4 int, primary key (col2, col4))") .withInsert("insert into P values(?,?,?,?)") .withRows(rows(row(1, "a", 1, 1))) .create(); new TableCreator(conn) .withCreate("create table C (col1 int primary key, col2 varchar(2), col3 int, col4 int, constraint CHILD_FKEY foreign key(col2, col3) references P(col2, col4) )") .create(); conn.commit(); try(Connection c = newNoAutoCommitConnection()) { c.setAutoCommit(false); try (Statement statement = c.createStatement()) { statement.executeUpdate("update P set col1 = 42"); } Thread.sleep(30 * 1000); c.rollback(); } try(Connection conn = newNoAutoCommitConnection()) { try(Statement s = conn.createStatement()) { s.executeUpdate("insert into C values (400, 'a', 1, 42)"); } conn.commit(); } }

Target:
public void rowHistoryIsReadyCorrectly() throws Exception { new TableCreator(conn) .withCreate("create table P(col1 int, col2 varchar(2), col3 int, col4 int, primary key (col2, col4))") .withInsert("insert into P values(?,?,?,?)") .withRows(rows(row(1, "a", 1, 1))) .create(); new TableCreator(conn) .withCreate("create table C (col1 int primary key, col2 varchar(2), col3 int, col4 int, constraint CHILD_FKEY foreign key(col2, col3) references P(col2, col4) )") .create(); conn.commit(); try(Connection c = newNoAutoCommitConnection()) { c.setAutoCommit(false); try (Statement statement = c.createStatement()) { statement.executeUpdate("update P set col1 = 42"); } c.rollback(); } try(Connection conn = newNoAutoCommitConnection()) { try(Statement s = conn.createStatement()) { s.executeUpdate("insert into C values (400, 'a', 1, 42)"); } conn.commit(); } }