auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void afterPush(@Nullable Repository repo, ReplicaPushRequest req) { Collection<ReceiveCommand> cmds = req.getCommands(); ReceiveCommand acceptCmd = null; ReceiveCommand commitCmd = null; List<ReceiveCommand> stages = null; for (ReceiveCommand c : cmds) { if (getSystem().getTxnAccepted().equals(c.getRefName())) { acceptCmd = c; } else if (getSystem().getTxnCommitted().equals(c.getRefName())) { commitCmd = c; } else if (c.getResult() == OK && c.getType() == CREATE && c.getRefName().startsWith(getSystem().getTxnStage())) { if (stages == null) { stages = new ArrayList<>(); } stages.add(c); } } if (repo != null && acceptCmd != null && acceptCmd.getResult() != OK) { checkLagging(repo, acceptCmd, req); } leader.lock.lock(); try { for (ReceiveCommand c : cmds) { running.remove(c.getRefName()); } Throwable err = req.getException(); if (err != null) { state = OFFLINE; error = err.toString(); retryLater(req); leader.onReplicaUpdate(this); return; } lastRetryMillis = 0; error = null; updateView(req, acceptCmd, commitCmd); if (acceptCmd != null && acceptCmd.getResult() == OK) { state = hasAccepted(leader.getHead()) ? CURRENT : LAGGING; if (stages != null) { staged.put(acceptCmd.getNewId(), stages); } } leader.onReplicaUpdate(this); nextPush(); } finally { leader.lock.unlock(); } }

Target:
void afterPush(@Nullable Repository repo, ReplicaPushRequest req) { Collection<ReceiveCommand> cmds = req.getCommands(); ReceiveCommand acceptCmd = null; ReceiveCommand commitCmd = null; List<ReceiveCommand> stages = null; for (ReceiveCommand c : cmds) { if (getSystem().getTxnAccepted().equals(c.getRefName())) { acceptCmd = c; } else if (getSystem().getTxnCommitted().equals(c.getRefName())) { commitCmd = c; } else if (c.getResult() == OK && c.getType() == CREATE && c.getRefName().startsWith(getSystem().getTxnStage())) { if (stages == null) { stages = new ArrayList<>(); } stages.add(c); } } if (repo != null && acceptCmd != null && acceptCmd.getResult() != OK) { state = checkLagging(repo, acceptCmd, req); } leader.lock.lock(); try { for (ReceiveCommand c : cmds) { running.remove(c.getRefName()); } Throwable err = req.getException(); if (err != null) { state = OFFLINE; error = err.toString(); retryLater(req); leader.onReplicaUpdate(this); return; } lastRetryMillis = 0; error = null; updateView(req, acceptCmd, commitCmd); if (acceptCmd != null && acceptCmd.getResult() == OK) { state = hasAccepted(leader.getHead()) ? CURRENT : LAGGING; if (stages != null) { staged.put(acceptCmd.getNewId(), stages); } } leader.onReplicaUpdate(this); runNextPushRequest(); } finally { leader.lock.unlock(); } }
Source:
public List<T> getAll(Guid userID, boolean isFiltered) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource(); if (userID != null) { parameterSource = parameterSource.addValue("user_id", userID.getUuid()); } if (isFiltered) { switch (getQosType()) { case NETWORK: return getCallsHandler().executeReadList("GetAllNetworkQos", createEntityRowMapper(), parameterSource); case CPU: return getCallsHandler().executeReadList("GetAllCpuQos", createEntityRowMapper(), getCustomMapSqlParameterSource()); case STORAGE: return getCallsHandler().executeReadList("GetAllStorageQos", createEntityRowMapper(), parameterSource); case HOSTNETWORK: return getCallsHandler().executeReadList("GetAllHostNetworkQos", createEntityRowMapper(), parameterSource); } } parameterSource = parameterSource.addValue("qos_type", getQosType()); return getCallsHandler().executeReadList("GetAllQosByQosType", createEntityRowMapper(), parameterSource); }

Target:
public List<T> getAll(Guid userID, boolean isFiltered) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource(); if (userID != null) { parameterSource = parameterSource.addValue("user_id", userID.getUuid()); } if (isFiltered) { switch (getQosType()) { case NETWORK: return getCallsHandler().executeReadList("GetAllNetworkQos", createEntityRowMapper(), parameterSource); case CPU: return getCallsHandler().executeReadList("GetAllCpuQos", createEntityRowMapper(), parameterSource); case STORAGE: return getCallsHandler().executeReadList("GetAllStorageQos", createEntityRowMapper(), parameterSource); case HOSTNETWORK: return getCallsHandler().executeReadList("GetAllHostNetworkQos", createEntityRowMapper(), parameterSource); } } parameterSource = parameterSource.addValue("qos_type", getQosType()); return getCallsHandler().executeReadList("GetAllQosByQosType", createEntityRowMapper(), parameterSource); }
Source:
private HyperLogLog[] getUniqueElements(int blockSize, long uniqueElements) { HyperLogLog[] array = new HyperLogLog[blockSize]; for (int j = 0; j < blockSize; j++) { HyperLogLog firstHll = HyperLogLog.newInstance(NUMBER_OF_BUCKETS); for (long i = j * uniqueElements / blockSize; i < j * uniqueElements / blockSize + uniqueElements / blockSize; i++) { firstHll.add(i); } array[j] = firstHll; } return array; }

Target:
private List<HyperLogLog> getUniqueElements(int blockSize, long uniqueElements) { ImmutableList.Builder<HyperLogLog> builder = ImmutableList.builder(); for (int j = 0; j < blockSize; j++) { HyperLogLog firstHll = HyperLogLog.newInstance(NUMBER_OF_BUCKETS); for (long i = j * uniqueElements / blockSize; i < j * uniqueElements / blockSize + uniqueElements / blockSize; i++) { firstHll.add(i); } builder.add(firstHll); } return builder.build(); }
Source:
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (this.clientRegistrationRepository != null && this.authorizedClientRepository != null) { OAuth2AuthorizedClientArgumentResolver authorizedClientArgumentResolver = new OAuth2AuthorizedClientArgumentResolver( this.clientRegistrationRepository, this.authorizedClientRepository); if (accessTokenResponseClient != null) { authorizedClientArgumentResolver.setClientCredentialsTokenResponseClient(accessTokenResponseClient); } argumentResolvers.add(authorizedClientArgumentResolver); } }

Target:
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (this.clientRegistrationRepository != null && this.authorizedClientRepository != null) { OAuth2AuthorizedClientArgumentResolver authorizedClientArgumentResolver = new OAuth2AuthorizedClientArgumentResolver( this.clientRegistrationRepository, this.authorizedClientRepository); if (this.accessTokenResponseClient != null) { authorizedClientArgumentResolver.setClientCredentialsTokenResponseClient(accessTokenResponseClient); } argumentResolvers.add(authorizedClientArgumentResolver); } }
Source:
protected ValidationResult isVmInterfacesConfigured(VM vm) { for (VmNetworkInterface nic : vm.getInterfaces()) { if (nic.getVnicProfileId() == null) { return !FeatureSupported.networkLinking(vm.getVdsGroupCompatibilityVersion()) ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_INTERFACE_NETWORK_NOT_CONFIGURED) : ValidationResult.VALID; } } return ValidationResult.VALID; }

Target:
protected ValidationResult isVmInterfacesConfigured(VM vm) { for (VmNetworkInterface nic : vm.getInterfaces()) { if (nic.getVnicProfileId() == null) { return FeatureSupported.networkLinking(vm.getVdsGroupCompatibilityVersion()) ? ValidationResult.VALID: new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_INTERFACE_NETWORK_NOT_CONFIGURED); } } return ValidationResult.VALID; }
Source:
private void handleThumbnailFromJfif(ByteOrderedDataInputStream in, HashMap thumbnailData) throws IOException { ExifAttribute jpegInterchangeFormatAttribute = (ExifAttribute) thumbnailData.get(TAG_JPEG_INTERCHANGE_FORMAT); ExifAttribute jpegInterchangeFormatLengthAttribute = (ExifAttribute) thumbnailData.get(TAG_JPEG_INTERCHANGE_FORMAT_LENGTH); if (jpegInterchangeFormatAttribute != null && jpegInterchangeFormatLengthAttribute != null) { int thumbnailOffset = jpegInterchangeFormatAttribute.getIntValue(mExifByteOrder); int thumbnailLength = jpegInterchangeFormatLengthAttribute.getIntValue(mExifByteOrder); if (mMimeType == IMAGE_TYPE_JPEG || mMimeType == IMAGE_TYPE_RAF || mMimeType == IMAGE_TYPE_RW2 || mMimeType == IMAGE_TYPE_PNG || mMimeType == IMAGE_TYPE_WEBP) { thumbnailOffset += mExifOffset; } else if (mMimeType == IMAGE_TYPE_ORF) { thumbnailOffset += mOrfMakerNoteOffset; } thumbnailLength = Math.min(thumbnailLength, in.getLength() - thumbnailOffset); if (DEBUG) { Log.d(TAG, "Setting thumbnail attributes with offset: " + thumbnailOffset + ", length: " + thumbnailLength); } if (thumbnailOffset > 0 && thumbnailLength > 0) { mHasThumbnail = true; mThumbnailOffset = thumbnailOffset; mThumbnailLength = thumbnailLength; if (mFilename == null && mAssetInputStream == null && mSeekableFileDescriptor == null) { byte[] thumbnailBytes = new byte[thumbnailLength]; in.seek(thumbnailOffset); in.readFully(thumbnailBytes); mThumbnailBytes = thumbnailBytes; } } } }

Target:
private void handleThumbnailFromJfif(ByteOrderedDataInputStream in, HashMap thumbnailData) throws IOException { ExifAttribute jpegInterchangeFormatAttribute = (ExifAttribute) thumbnailData.get(TAG_JPEG_INTERCHANGE_FORMAT); ExifAttribute jpegInterchangeFormatLengthAttribute = (ExifAttribute) thumbnailData.get(TAG_JPEG_INTERCHANGE_FORMAT_LENGTH); if (jpegInterchangeFormatAttribute != null && jpegInterchangeFormatLengthAttribute != null) { int thumbnailOffset = jpegInterchangeFormatAttribute.getIntValue(mExifByteOrder); int thumbnailLength = jpegInterchangeFormatLengthAttribute.getIntValue(mExifByteOrder); switch (mMimeType) { case IMAGE_TYPE_JPEG: case IMAGE_TYPE_RAF: case IMAGE_TYPE_RW2: case IMAGE_TYPE_PNG: case IMAGE_TYPE_WEBP: thumbnailOffset += mExifOffset; break; case IMAGE_TYPE_ORF: thumbnailOffset += mOrfMakerNoteOffset; break; } thumbnailLength = Math.min(thumbnailLength, in.getLength() - thumbnailOffset); if (DEBUG) { Log.d(TAG, "Setting thumbnail attributes with offset: " + thumbnailOffset + ", length: " + thumbnailLength); } if (thumbnailOffset > 0 && thumbnailLength > 0) { mHasThumbnail = true; mThumbnailOffset = thumbnailOffset; mThumbnailLength = thumbnailLength; if (mFilename == null && mAssetInputStream == null && mSeekableFileDescriptor == null) { byte[] thumbnailBytes = new byte[thumbnailLength]; in.seek(thumbnailOffset); in.readFully(thumbnailBytes); mThumbnailBytes = thumbnailBytes; } } } }
Source:
public PageCacheIntArray( PagedFile pagedFile, long length, long defaultValue, long base ) throws IOException { super( pagedFile, Integer.BYTES, length, defaultValue, base ); }

Target:
PageCacheIntArray( PagedFile pagedFile, long length, long defaultValue, long base ) throws IOException { super( pagedFile, Integer.BYTES, length, defaultValue | defaultValue << Integer.SIZE, base ); }
Source:
private void remove() { if (getEntity() != null) { if (getWindow() != null) { return; } Snapshot snapshot = getSelectedItem(); ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().deleteSnapshotTitle()); model.setHelpTag(HelpTag.delete_snapshot); model.setHashName("delete_snapshot"); String msg = messages.areYouSureYouWantToDeleteSanpshot(DateTimeFormat.getFormat(DATE_FORMAT) .format(snapshot.getCreationDate()), snapshot.getDescription()); String backupSupportedRawDisks = getRawFormatDisksWithBackupEnabled(); if (backupSupportedRawDisks!= null) { msg += messages.backupEnableWillRemovedForDisks(backupSupportedRawDisks); } model.setMessage(msg); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); model.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); model.getCommands().add(tempVar2); } }

Target:
private void remove() { if (getEntity() != null) { if (getWindow() != null) { return; } Snapshot snapshot = getSelectedItem(); ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().deleteSnapshotTitle()); model.setHelpTag(HelpTag.delete_snapshot); model.setHashName("delete_snapshot"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(messages.areYouSureYouWantToDeleteSanpshot(DateTimeFormat.getFormat(DATE_FORMAT) .format(snapshot.getCreationDate()), snapshot.getDescription());) String backupSupportedRawDisks = getRawFormatDisksWithBackupEnabled(); if (!backupSupportedRawDisks.isEmpty()) { stringBuilder.append(messages.backupEnableWillRemovedForDisks(backupSupportedRawDisks)); } model.setMessage(stringBuilder.toString()); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); model.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); model.getCommands().add(tempVar2); } }
Source:
public void end(OperationTiming overallTiming) { if (overallTiming == null && timings.isEmpty()) { return; } long wallEnd = ticker.read(); long cpuEnd; long userEnd; if (wallEnd - intervalWallStart < minNanosForCpuTiming) { cpuEnd = currentThreadCpuTime(); userEnd = currentThreadUserTime(); } else { cpuEnd = intervalCpuStart; userEnd = intervalUserStart; } if (overallTiming != null) { long wallDuration = wallEnd - wallStart; overallTiming.recordWallTime(wallDuration); if (cpuEnd > cpuStart) { overallTiming.recordEstimatedCpuTime(cpuEnd - cpuStart); overallTiming.recordEstimatedUserTime(userEnd - userStart); } else { overallTiming.recordEstimatedCpuTime(wallDuration); overallTiming.recordEstimatedUserTime(wallDuration); } } long totalUnaccountedCpuWallNanos = timings.values().stream() .mapToLong(InternalTiming::getCpuUnaccountedWallNanos) .sum(); long totalMeasuredCpuNanos = timings.values().stream() .mapToLong(InternalTiming::getCpuMeasuredNanos) .sum(); long totalUnaccountedCpuNanos = max(0, cpuEnd - cpuStart - totalMeasuredCpuNanos); long totalMeasuredUserNanos = timings.values().stream() .mapToLong(InternalTiming::getUserMeasuredNanos) .sum(); long totalUnaccountedUserNanos = max(0, userEnd - userStart - totalMeasuredUserNanos); for (InternalTiming timing : timings.values()) { timing.recordTimings(totalUnaccountedCpuNanos, totalUnaccountedUserNanos, totalUnaccountedCpuWallNanos); } }

Target:
public void end(OperationTiming overallTiming) { if (overallTiming == null && timings.isEmpty()) { return; } long wallEnd = ticker.read(); long cpuEnd = currentThreadCpuTime(); long userEnd = currentThreadUserTime(); if (overallTiming != null) { long wallDuration = wallEnd - wallStart; overallTiming.recordWallTime(wallDuration); if (cpuEnd > cpuStart) { overallTiming.recordEstimatedCpuTime(cpuEnd - cpuStart); overallTiming.recordEstimatedUserTime(userEnd - userStart); } else { overallTiming.recordEstimatedCpuTime(wallDuration); overallTiming.recordEstimatedUserTime(wallDuration); } } long totalUnaccountedCpuWallNanos = timings.values().stream() .mapToLong(InternalTiming::getCpuUnaccountedWallNanos) .sum(); long totalMeasuredCpuNanos = timings.values().stream() .mapToLong(InternalTiming::getCpuMeasuredNanos) .sum(); long totalUnaccountedCpuNanos = max(0, cpuEnd - cpuStart - totalMeasuredCpuNanos); long totalMeasuredUserNanos = timings.values().stream() .mapToLong(InternalTiming::getUserMeasuredNanos) .sum(); long totalUnaccountedUserNanos = max(0, userEnd - userStart - totalMeasuredUserNanos); for (InternalTiming timing : timings.values()) { timing.recordTimings(totalUnaccountedCpuNanos, totalUnaccountedUserNanos, totalUnaccountedCpuWallNanos); } }
Source:
protected IStatus validate() { final String connectionName = this.connectionNameModelObservable .getValue(); if (connectionName == null || connectionName.isEmpty()) { return ValidationStatus.error(WizardMessages.getString( "DockerConnectionPage.validation.missingConnectionName.msg")); } else if (!connectionName.equals(this.initialConnectionName) && DockerConnectionManager.getInstance() .findConnection(connectionName) != null) { return ValidationStatus.error(WizardMessages.getString( "DockerConnectionPage.validation.duplicateConnectionName.msg")); } System.err.println("Name Validation status: OK"); return ValidationStatus.ok(); }

Target:
protected IStatus validate() { final String connectionName = this.connectionNameModelObservable .getValue(); if (connectionName == null || connectionName.isEmpty()) { return ValidationStatus.error(WizardMessages.getString( "DockerConnectionPage.validation.missingConnectionName.msg")); } else if (!connectionName.equals(this.initialConnectionName) && DockerConnectionManager.getInstance() .findConnection(connectionName) != null) { return ValidationStatus.error(WizardMessages.getString( "DockerConnectionPage.validation.duplicateConnectionName.msg")); } return ValidationStatus.ok(); }
Source:
protected AnchorListItem getBulkClaim(final ExtendedPagedTable<TaskSummary> extendedPagedTable) { final AnchorListItem bulkAbortNavLink = GWT.create(AnchorListItem.class); bulkAbortNavLink.setText(constants.Bulk_Claim()); bulkAbortNavLink.setIcon(IconType.LOCK); bulkAbortNavLink.setIconFixedWidth(true); bulkAbortNavLink.addClickHandler(event -> confirmPopup.show(constants.Claim_tasks(), constants.Claim(), constants.Claim_Confirmation(), getClaimCommand(extendedPagedTable)) ); return bulkAbortNavLink; }

Target:
protected AnchorListItem getBulkClaim(final ExtendedPagedTable<TaskSummary> extendedPagedTable) { final AnchorListItem bulkClaimNavLink = GWT.create(AnchorListItem.class); bulkClaimNavLink.setText(constants.Bulk_Claim()); bulkClaimNavLink.setIcon(IconType.LOCK); bulkClaimNavLink.setIconFixedWidth(true); bulkClaimNavLink.addClickHandler(event -> confirmPopup.show(constants.Claim_tasks(), constants.Claim(), constants.Claim_Confirmation(), getClaimCommand(extendedPagedTable)) ); return bulkClaimNavLink; }
Source:
public void cleanup() throws Exception { if (workspaceItem != null) { System.out.println("remove workspaceitem"); deleteWsi(workspaceItem); } if (workflowItem != null) { System.out.println("remove workflowitem"); delete(workflowItem); } if (item != null) { System.out.println("remove item!!!"); deleteItem(item); } }

Target:
public void cleanup() throws Exception { if (workspaceItem != null) { deleteWsi(workspaceItem); } if (workflowItem != null) { delete(workflowItem); } if (item != null) { deleteItem(item); } }
Source:
protected void doHandle(CommandContext ctx) throws CommandLineException { EmbeddedServerLaunch hostControllerLaunch = hostControllerReference.get(); if (hostControllerLaunch != null && hostControllerLaunch.getHostController() != null) { ctx.disconnectController(); } }

Target:
protected void doHandle(CommandContext ctx) throws CommandLineException { EmbeddedServerLaunch hostControllerLaunch = hostControllerReference.get(); if (hostControllerLaunch != null) { ctx.disconnectController(); } }
Source:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); MenuItem searchItem = menu.findItem(R.id.action_search); searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem menuItem) { return true; } @Override public boolean onMenuItemActionCollapse(MenuItem menuItem) { getLoaderManager().restartLoader(0, null, (MainMode)getFragmentManager().findFragmentByTag(MainMode.class.getSimpleName())); return true; } }); return super.onCreateOptionsMenu(menu); }

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return super.onCreateOptionsMenu(menu); }
Source:
protected NIC populate(NIC model, VmNetworkInterface entity) { BackendVmNicsResource parent = (BackendVmNicsResource)collection; Guid clusterId = parent.getClusterId(); network network = parent.getClusterNetwork(clusterId, null, model.getNetwork().getName()); String networkId = network == null ? null : network.getId().toString(); model.getNetwork().setId(networkId); model.getNetwork().setName(null); if (model.isSetPortMirroring() && model.getPortMirroring().isSetNetworks() && model.getPortMirroring().getNetworks().getNetworks().size() == 1) { model.getPortMirroring().getNetworks().getNetworks().get(0).setId(networkId); } return parent.addStatistics(model, entity, uriInfo, httpHeaders); }

Target:
protected NIC populate(NIC model, VmNetworkInterface entity) { BackendVmNicsResource parent = (BackendVmNicsResource)collection; Guid clusterId = parent.getClusterId(); network network = parent.getClusterNetwork(clusterId, null, model.getNetwork().getName()); String networkId = network == null ? null : network.getId().toString(); model.getNetwork().setId(networkId); model.getNetwork().setName(null); if (entity.isPortMirroring()) { PortMirroring portMirroring = new PortMirroring(); Networks networks = new Networks(); Network net = new Network(); net.setId(networkId); portMirroring.setNetworks(networks); portMirroring.getNetworks().getNetworks().add(net); model.setPortMirroring(portMirroring); } return parent.addStatistics(model, entity, uriInfo, httpHeaders); }
Source:
protected StatusRow lockStatusRow(UUID queryId) { try (Statement stmt = connection.createStatement()) { ResultSet rs = stmt.executeQuery(String.format(ENGLISH, "SELECT completed_at FROM %s WHERE query_id = '%s' FOR UPDATE NOWAIT", escapeIdent(statusTableName), queryId.toString()) ); if (rs.next()) { rs.getTimestamp(1); if (rs.wasNull()) { return StatusRow.LOCKED_NOT_COMPLETED; } else { return StatusRow.LOCKED_COMPLETED; } } else { return StatusRow.NOT_EXISTS; } } catch (SQLException ex) { throw new DatabaseException("Failed to lock a status row", ex); } }

Target:
protected StatusRow lockStatusRow(UUID queryId) throws LockConflictException { try (Statement stmt = connection.createStatement()) { ResultSet rs = stmt.executeQuery(String.format(ENGLISH, "SELECT completed_at FROM %s WHERE query_id = '%s' FOR UPDATE NOWAIT", escapeIdent(statusTableName), queryId.toString()) ); if (rs.next()) { rs.getTimestamp(1); if (rs.wasNull()) { return StatusRow.LOCKED_NOT_COMPLETED; } else { return StatusRow.LOCKED_COMPLETED; } } else { return StatusRow.NOT_EXISTS; } } catch (SQLException ex) { if (ex.getSQLState().equals("55P03")) { throw new LockConflictException("Failed to acquire a status row lock", ex); } else { throw new DatabaseException("Failed to lock a status row", ex); } } }
Source:
private String getAddressConsideringPciSlotOccupancy(VmDevice vmDevice){ String address = vmDevice.getAddress(); if (StringUtils.isEmpty(address)) { return address; } Map<String, String> deviceAddressMap = XmlRpcStringUtils.string2Map(address); if (!ADDRESS_TYPE_PCI.equals(deviceAddressMap.get(ADDRESS_TYPE))){ return address; } VmDeviceId deviceId = vmDevice.getId(); VmDeviceId deviceIdOccupyingPciSlot = occupiedPciSlots.get(deviceAddressMap); if (deviceIdOccupyingPciSlot == null || deviceIdOccupyingPciSlot.equals(deviceId)){ return address; } return ""; }

Target:
private String getAddressConsideringPciSlotOccupancy(VmDevice vmDevice){ String address = vmDevice.getAddress(); VmDevicePciAddress deviceAddress = new VmDevicePciAddress(address); if (!deviceAddress.isPciAddress()){ return address; } VmDeviceId deviceId = vmDevice.getId(); VmDeviceId deviceIdOccupyingPciSlot = occupiedPciSlots.get(deviceAddress); if (deviceIdOccupyingPciSlot == null || deviceIdOccupyingPciSlot.equals(deviceId)){ return address; } return ""; }
Source:
public void testCloneSingleTrace() { SWTBotMenu cloneMenu = fOriginalViewBot.viewMenu().menu(NEW_CALL_STACK_MENU); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName()).click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_UST_CALL_STACK_VIEW_TITLE); assertEquals("Should not have created a new instance", 1, fBot.editors().size()); clonedView.close(); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName() + " | new instance").click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); clonedView = fBot.viewByTitle("Call Stack <context-switches-ust | 2>"); assertEquals("Should have created a new instance", 2, fBot.editors().size()); SWTBotEditor cloneEditor = fBot.editorByTitle(fUstTestTrace.getName() + " | 2"); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace cloneTrace = traceManager.getActiveTrace(); TmfTimeRange expectedCloneRange = traceManager.getCurrentTraceContext().getWindowRange(); SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName()); fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click(); ITmfTrace ust = traceManager.getActiveTrace(); updateTimeRange(ust, UST_START + SECOND, UST_START + 2* SECOND); IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false); assertTrue(part instanceof AbstractTimeGraphView); AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part; fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, cloneTrace, expectedCloneRange)); cloneEditor.close(); }

Target:
public void testCloneSingleTrace() { SWTBotMenu cloneMenu = fOriginalViewBot.viewMenu().menu(NEW_CALL_STACK_MENU); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName()).click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); SWTBotView clonedView = fBot.viewByTitle(PINNED_TO_UST_CALL_STACK_VIEW_TITLE); assertEquals("Should not have created a new instance", 1, fBot.editors().size()); clonedView.close(); cloneMenu.menu(PINNED_TO_PREFIX + fUstTestTrace.getName() + " | new instance").click(); assertOriginalViewTitle(CALL_STACK_VIEW_TITLE); clonedView = fBot.viewByTitle("Call Stack <context-switches-ust | 2>"); assertEquals("Should have created a new instance", 2, fBot.editors().size()); SWTBotEditor cloneEditor = fBot.editorByTitle(fUstTestTrace.getName() + CLONED_TRACE_SUFFIX); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace cloneTrace = traceManager.getActiveTrace(); assertNotNull(cloneTrace); SWTBotUtils.activateEditor(fBot, fUstTestTrace.getName()); fOriginalViewBot.toolbarButton(PIN_VIEW_BUTTON_NAME).click(); ITmfTrace ust = traceManager.getActiveTrace(); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust)); SWTBotUtils.activateEditor(fBot, cloneTrace.getName() + CLONED_TRACE_SUFFIX); IWorkbenchPart part = clonedView.getViewReference().getPart(false); assertTrue(part instanceof AbstractTimeGraphView); AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part; fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, cloneTrace, INITIAL_UST_RANGE)); cloneEditor.close(); }
Source:
public FactoryDto resolveFactory( @ApiParam(value = "Parameters provided to create factories") Map<String, String> parameters, @ApiParam( value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam(VALIDATE_QUERY_PARAMETER) Boolean validate) throws BadRequestException { requiredNotNull(parameters, "Factory build parameters"); FactoryDto resolvedFactory = null; for (FactoryParametersResolver resolver : specificFactoryParametersResolvers) { if (resolver.accept(parameters)) { resolvedFactory = resolver.createFactory(parameters); break; } } if (resolvedFactory == null) { resolvedFactory = defaultFactoryResolver.createFactory(parameters); } if (resolvedFactory != null) { if (validate) { acceptValidator.validateOnAccept(resolvedFactory); } return injectLinks(resolvedFactory); } throw new BadRequestException(FACTORY_NOT_RESOLVABLE); }

Target:
public FactoryDto resolveFactory( @ApiParam(value = "Parameters provided to create factories") Map<String, String> parameters, @ApiParam( value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam(VALIDATE_QUERY_PARAMETER) Boolean validate) throws BadRequestException, ServerException { requiredNotNull(parameters, "Factory build parameters"); FactoryDto resolvedFactory = factoryParametersResolverHolder .getFactoryParametersResolver(parameters) .createFactory(parameters); if (resolvedFactory == null) { throw new BadRequestException(FACTORY_NOT_RESOLVABLE); } if (validate) { acceptValidator.validateOnAccept(resolvedFactory); } return injectLinks(resolvedFactory); }
Source:
public void testNotCreatedByRead() throws IOException { final Context ctx = new Context(); final DataHandleService dhs = ctx.service(DataHandleService.class); final File nonExistentFile = File.createTempFile("FileHandleTest", "none xistent file"); final URI uri = nonExistentFile.toURI(); assertTrue(nonExistentFile.delete()); assertFalse(nonExistentFile.exists()); final FileLocation loc = new FileLocation(uri); final DataHandle<?> handle = dhs.create(loc); assertFalse(handle.exists()); try { handle.read(); fail("Read successfully from non-existing file!"); } catch (final Exception exc) { } assertFalse(handle.exists()); handle.close(); }

Target:
public void testNotCreatedByRead() throws IOException { final Context ctx = new Context(); final DataHandleService dhs = ctx.service(DataHandleService.class); final File nonExistentFile = File.createTempFile("FileHandleTest", "none xistent file"); final URI uri = nonExistentFile.toURI(); assertTrue(nonExistentFile.delete()); assertFalse(nonExistentFile.exists()); final FileLocation loc = new FileLocation(uri); try (final DataHandle<?> handle = dhs.create(loc)) { assertFalse(handle.exists()); handle.read(); fail("Read successfully from non-existing file!"); } catch (final IOException exc) { } assertFalse(nonExistentFile.exists()); }
Source:
public static void addTypes(Biome biome, Type... types) { Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome); List<Type> subTypes = listSupertypes(types); for (Type type : subTypes) { type.biomes.add(biome); } getBiomeInfo(biome).types.addAll(subTypes); }

Target:
public static void addTypes(Biome biome, Type... types) { Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome); Collection<Type> supertypes = listSupertypes(types); for (Type type : supertypes) { type.biomes.add(biome); } getBiomeInfo(biome).types.addAll(supertypes); }
Source:
public void testGetProcessImageViaUIClientTest() throws Exception { String result = uiServicesClient.getProcessImage(CONTAINER_ID, HIRING_PROCESS_ID); logger.debug("Image content is '{}'", result); assertNotNull(result); assertFalse(result.isEmpty()); result = uiServicesClient.getProcessImage(CONTAINER_ID, HIRING_2_PROCESS_ID); logger.debug("Image content is '{}'", result); assertNotNull(result); assertFalse(result.isEmpty()); result = uiServicesClient.getProcessImage(CONTAINER_ID, HIRING_3_PROCESS_ID); logger.debug("Image content is '{}'", result); assertNotNull(result); assertFalse(result.isEmpty()); }

Target:
public void testGetProcessImageViaUIClientTest() throws Exception { String result = uiServicesClient.getProcessImage(CONTAINER_ID, HIRING_PROCESS_ID); assertImageContent(result); result = uiServicesClient.getProcessImage(CONTAINER_ID, HIRING_2_PROCESS_ID); assertImageContent(result); result = uiServicesClient.getProcessImage(CONTAINER_ID, HIRING_3_PROCESS_ID); assertImageContent(result); }
Source:
public View getDropDownView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getActivity().getLayoutInflater() .inflate(R.layout.two_line_spinner_dropdown_item, null); } Choice c = this.getItem(position); TextView text1 = (TextView) convertView.findViewById(android.R.id.text1); TextView text2 = (TextView) convertView.findViewById(android.R.id.text2); text1.setText(c.getName()); text2.setText(" - " + c.getDescription()); return convertView; }

Target:
public View getDropDownView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getActivity().getLayoutInflater() .inflate(R.layout.two_line_spinner_dropdown_item, parent, false); } Choice c = this.getItem(position); TextView text1 = (TextView) convertView.findViewById(android.R.id.text1); TextView text2 = (TextView) convertView.findViewById(android.R.id.text2); text1.setText(c.getName()); text2.setText(Html.fromHtml(c.getDescription())); return convertView; }
Source:
protected ModelNode parseResponse(CloseableHttpResponse response) throws IOException { ModelNode result; String content = EntityUtils.toString(response.getEntity()); int status = response.getStatusLine().getStatusCode(); if (status == HttpStatus.SC_OK) { result = ModelNode.fromJSONString(content); } else { result = new ModelNode(); result.get(Constants.OUTCOME).set(Constants.FAILED); result.get(Constants.FAILURE_DESCRIPTION).set(content); } return result; }

Target:
private ModelNode parseResponse(CloseableHttpResponse response) throws IOException { ModelNode result; String content = EntityUtils.toString(response.getEntity()); int status = response.getStatusLine().getStatusCode(); if (status == HttpStatus.SC_OK || status == HttpStatus.SC_INTERNAL_SERVER_ERROR) { result = ModelNode.fromJSONString(content); } else { throw new RuntimeException(String.format("Server responded %s%nMessage:%n%s", status, content)); } return result; }
Source:
public ElasticsearchClient(ElasticsearchTableDescriptionProvider descriptions, Duration requestTimeout) throws IOException { tableDescriptions = requireNonNull(descriptions, "description is null"); timeout = requireNonNull(requestTimeout, "requestTimeout is null"); for (ElasticsearchTableDescription tableDescription : tableDescriptions.getAllTableDescriptions()) { if (!clients.containsKey(tableDescription.getClusterName())) { Settings settings = Settings.builder().put("cluster.name", tableDescription.getClusterName()).build(); TransportAddress address = new TransportAddress(InetAddress.getByName(tableDescription.getHost()), tableDescription.getPort()); TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(address); clients.put(tableDescription.getClusterName(), client); } } }

Target:
public ElasticsearchClient(ElasticsearchTableDescriptionProvider descriptions, Duration requestTimeout) throws IOException { tableDescriptions = requireNonNull(descriptions, "description is null"); timeout = requireNonNull(requestTimeout, "requestTimeout is null"); for (ElasticsearchTableDescription tableDescription : tableDescriptions.getAllTableDescriptions()) { if (!clients.containsKey(tableDescription.getClusterName())) { Settings settings = Settings.builder().put("cluster.name", tableDescription.getClusterName()).build(); TransportAddress address = new TransportAddress(InetAddress.getByName(tableDescription.getHost()), tableDescription.getPort()); TransportClient client = new PreBuiltTransportClient(settings).addTransportAddress(address); clients.put(tableDescription.getClusterName(), client); } } this.tableColumnsCache = CacheBuilder.newBuilder() .expireAfterWrite(30, MINUTES) .refreshAfterWrite(15, MINUTES) .maximumSize(500) .build(asyncReloading(CacheLoader.from(this::loadColumns), executor)); }
Source:
public void annotationToMethodsReturnsUnmodifiableMap() { exception.expect(UnsupportedOperationException.class); TestClass tc = new TestClass(MethodsAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkMethod>> annotationToMethods = tc.getAnnotationToMethods(); annotationToMethods.put(Ignore.class, null); }

Target:
public void annotationToMethodsReturnsUnmodifiableMap() { TestClass tc = new TestClass(MethodsAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkMethod>> annotationToMethods = tc.getAnnotationToMethods(); exception.expect(UnsupportedOperationException.class); annotationToMethods.put(Ignore.class, null); }
Source:
public SmeltingRecipe.Builder from(SmeltingRecipe value) { this.exemplaryResult = value.getExemplaryResult(); this.exemplaryIngredient = value.getExemplaryIngredient(); this.experience = 0; return this; }

Target:
public SmeltingRecipe.Builder from(SmeltingRecipe value) { checkNotNull(value, "value"); this.exemplaryResult = value.getExemplaryResult(); this.exemplaryIngredient = value.getExemplaryIngredient(); this.experience = 0; return this; }
Source:
public SessionAndContactsTreeView(@NotNull Project project) { super(new SarosTreeRootNode()); Disposer.register(project, this); SarosPluginContext.initComponent(this); sessionTreeRootNode = new SessionTreeRootNode(this); ((SarosTreeRootNode) getModel().getRoot()).add(sessionTreeRootNode); contactTreeRootNode = new ContactTreeRootNode(this); ((SarosTreeRootNode) getModel().getRoot()).add(contactTreeRootNode); addMouseListener(new TreeClickListener(this)); getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); setCellRenderer(renderer); connectionHandler.addConnectionStateListener(connectionStateListener); contactsUpdateListener = (contact, updateType) -> { if (project.isDisposed()) { return; } if (updateType == UpdateType.ADDED || updateType == UpdateType.REMOVED) { renderConnected(); } }; xmppContactsService.addListener(contactsUpdateListener); renderConnectionState(connectionHandler.getConnectionState()); sessionTreeRootNode.setInitialState(); }

Target:
public SessionAndContactsTreeView(@NotNull Project project) { super(new SarosTreeRootNode()); this.project = project; Disposer.register(project, this); SarosPluginContext.initComponent(this); sessionTreeRootNode = new SessionTreeRootNode(this); ((SarosTreeRootNode) getModel().getRoot()).add(sessionTreeRootNode); contactTreeRootNode = new ContactTreeRootNode(this); ((SarosTreeRootNode) getModel().getRoot()).add(contactTreeRootNode); addMouseListener(new TreeClickListener(this)); getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); setCellRenderer(renderer); connectionHandler.addConnectionStateListener(connectionStateListener); xmppContactsService.addListener(contactsUpdateListener); renderConnectionState(connectionHandler.getConnectionState()); sessionTreeRootNode.setInitialState(); }
Source:
public void scannerBlocksWhenFull() throws Exception { final AtomicLong timeBeforeBlock = new AtomicLong(); final AtomicLong timeAfterBlock = new AtomicLong(); final int queueDepth = 10; final CountDownLatch addProcessDone = new CountDownLatch(1); final ResponseQueueReader reader = new ResponseQueueReader(10, defaultTimeout); final ExecutorService executorService = Executors.newFixedThreadPool(1); final List<ReadRowsResponse> responses = generateReadRowsResponses("rowKey-%s", queueDepth * 2); executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { for (int i = 0; i < queueDepth; i++) { reader.add(ResultQueueEntry.<ReadRowsResponse> newResult(responses.get(i))); } timeBeforeBlock.set(System.currentTimeMillis()); reader.add(ResultQueueEntry.<ReadRowsResponse> newResult(responses.get(queueDepth))); timeAfterBlock.set(System.currentTimeMillis()); reader.add(ResultQueueEntry.<ReadRowsResponse> newCompletionMarker()); addProcessDone.countDown(); return null; } }); Assert.assertFalse(addProcessDone.await(500, TimeUnit.MILLISECONDS)); reader.getNextMergedRow(); reader.getNextMergedRow(); Assert.assertTrue( "Expected add process to complete within 500 ms", addProcessDone.await(500, TimeUnit.MILLISECONDS)); executorService.shutdownNow(); }

Target:
public void scannerBlocksWhenFull() throws Exception { final AtomicLong timeBeforeBlock = new AtomicLong(); final AtomicLong timeAfterBlock = new AtomicLong(); final int queueDepth = 10; final CountDownLatch addProcessDone = new CountDownLatch(1); final ResponseQueueReader reader = new ResponseQueueReader(queueDepth, defaultTimeout); final ExecutorService executorService = Executors.newFixedThreadPool(1); final List<ReadRowsResponse> responses = generateReadRowsResponses("rowKey-%s", queueDepth * 2); executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { for (int i = 0; i < queueDepth; i++) { reader.add(ResultQueueEntry.<ReadRowsResponse> newResult(responses.get(i))); } timeBeforeBlock.set(System.currentTimeMillis()); reader.add(ResultQueueEntry.<ReadRowsResponse> newResult(responses.get(queueDepth))); timeAfterBlock.set(System.currentTimeMillis()); reader.add(ResultQueueEntry.<ReadRowsResponse> newCompletionMarker()); addProcessDone.countDown(); return null; } }); Assert.assertFalse(addProcessDone.await(500, TimeUnit.MILLISECONDS)); reader.getNextMergedRow(); reader.getNextMergedRow(); Assert.assertTrue( "Expected add process to complete within 500 ms", addProcessDone.await(500, TimeUnit.MILLISECONDS)); executorService.shutdownNow(); }
Source:
public void dcConfigChangePropagatedAfterRestart() throws Exception { domainConfig.getSlaveConfiguration().setCachedDC(true); domainManager = DomainTestSupport.create(domainConfig); domainManager.start(); domainManager.getDomainSlaveLifecycleUtil().stop(); long deadline = System.currentTimeMillis() + 1000; while (true) { if (!domainManager.getDomainSlaveLifecycleUtil().isHostControllerStarted()) { break; } if (System.currentTimeMillis() > deadline) { break; } } Assert.assertEquals(false, domainManager.getDomainSlaveLifecycleUtil().isHostControllerStarted()); domainManager.getDomainMasterLifecycleUtil() .executeForResult(getCreateOperationTestLoggingCategory()); domainManager.stop(); domainConfig.getMasterConfiguration().setRewriteConfigFiles(false); domainConfig.getSlaveConfiguration().setRewriteConfigFiles(false); domainManager.getDomainSlaveLifecycleUtil().startAsync(); try (DomainClient clientSlave = getDomainClient(domainConfig.getSlaveConfiguration())) { waitForHostControllerBeingStarted(TIMEOUT_S, clientSlave); waitForServersBeingStarted(TIMEOUT_S, clientSlave); } domainManager.getDomainMasterLifecycleUtil().startAsync(); try (DomainClient clientMaster = getDomainClient(domainConfig.getSlaveConfiguration())) { waitForHostControllerBeingStarted(TIMEOUT_S, clientMaster); waitForServersBeingStarted(TIMEOUT_S, clientMaster); } runWithTimeout(TIMEOUT_S, () -> checkHostControllerLogFile(domainConfig.getSlaveConfiguration(), "WFLYHC0202")); }

Target:
public void dcConfigChangePropagatedAfterRestart() throws Exception { domainConfig.getSlaveConfiguration().setCachedDC(true); domainManager = DomainTestSupport.create(domainConfig); domainManager.start(); domainManager.getDomainSlaveLifecycleUtil().stop(); long deadline = System.currentTimeMillis() + 1000; while (true) { if (!domainManager.getDomainSlaveLifecycleUtil().isHostControllerStarted()) { break; } if (System.currentTimeMillis() > deadline) { break; } Thread.sleep(TIMEOUT_SLEEP_MILLIS); } Assert.assertEquals(false, domainManager.getDomainSlaveLifecycleUtil().isHostControllerStarted()); domainManager.getDomainMasterLifecycleUtil() .executeForResult(getCreateOperationTestLoggingCategory()); domainManager.stop(); domainConfig.getMasterConfiguration().setRewriteConfigFiles(false); domainConfig.getSlaveConfiguration().setRewriteConfigFiles(false); domainManager.getDomainSlaveLifecycleUtil().startAsync(); try (DomainClient clientSlave = getDomainClient(domainConfig.getSlaveConfiguration())) { waitForHostControllerBeingStarted(TIMEOUT_S, clientSlave); waitForServersBeingStarted(TIMEOUT_S, clientSlave); } domainManager.getDomainMasterLifecycleUtil().startAsync(); try (DomainClient clientMaster = getDomainClient(domainConfig.getSlaveConfiguration())) { waitForHostControllerBeingStarted(TIMEOUT_S, clientMaster); waitForServersBeingStarted(TIMEOUT_S, clientMaster); } runWithTimeout(TIMEOUT_S, () -> checkHostControllerLogFile(domainConfig.getSlaveConfiguration(), "WFLYHC0202")); }
Source:
private void stop() { if (this.initializeFuture != null) { this.initializeFuture.cancel(true); this.initializeFuture = null; } this.initializeResult = null; if (this.languageServer != null) { try { this.languageServer.shutdown(); } catch (Exception ex) { } } if (this.launcherFuture != null) { this.launcherFuture.cancel(true); this.launcherFuture = null; } if (this.lspStreamProvider != null) { this.lspStreamProvider.stop(); } while (!this.documents.isEmpty()) { for (IPath path : this.documents.keySet()) { disconnect(path); } } this.languageServer = null; FileBuffers.getTextFileBufferManager().removeFileBufferListener(this); }

Target:
private void stop() { if (this.initializeFuture != null) { this.initializeFuture.cancel(true); this.initializeFuture = null; } this.initializeResult = null; if (this.languageServer != null) { try { this.languageServer.shutdown(); } catch (Exception ex) { } } if (this.launcherFuture != null) { this.launcherFuture.cancel(true); this.launcherFuture = null; } if (this.lspStreamProvider != null) { this.lspStreamProvider.stop(); } while (!this.documents.isEmpty()) { disconnect(this.documents.keySet().iterator().next()); } this.languageServer = null; FileBuffers.getTextFileBufferManager().removeFileBufferListener(fileBufferListener); }
Source:
private void parseST(final STAlgorithm st) throws TypeImportException, XMLStreamException { String text = getAttributeValue(LibraryElementTags.TEXT_ATTRIBUTE); if (text != null) { st.setText(text); } else { throw new TypeImportException(Messages.FBTImporter_ST_TEXTNOTSET_EXCEPTION); } proceedToEndElementNamed(LibraryElementTags.ST_ELEMENT); }

Target:
private void parseST(final STAlgorithm st) throws TypeImportException, XMLStreamException { String text = getAttributeValue(LibraryElementTags.TEXT_ATTRIBUTE); if (null != text) { st.setText(text); } else { throw new TypeImportException(Messages.FBTImporter_ST_TEXTNOTSET_EXCEPTION); } proceedToEndElementNamed(LibraryElementTags.ST_ELEMENT); }
Source:
public Schema createSchema(DocumentType input) { Schema schema = Schema.createRecord(getName(input), null, input.getNamespace().prefix, false); new LogicalType("documentType").addToSchema(schema); List<Field> fields = new ArrayList<>(input.getSchemas().size()); for (org.nuxeo.ecm.core.schema.types.Schema s : context.sort(input.getSchemas())) { fields.add(new Field(s.getName(), context.createSchema(s), null, (Object) null)); } schema.setFields(fields); return schema; }

Target:
public Schema createSchema(DocumentType input) { Schema schema = Schema.createRecord(getName(input), null, input.getNamespace().prefix, false); new LogicalType(DocumentModelMapper.DOCUMENT_TYPE).addToSchema(schema); List<Field> fields = new ArrayList<>(input.getSchemas().size()); for (org.nuxeo.ecm.core.schema.types.Schema s : context.sort(input.getSchemas())) { fields.add(new Field(s.getName(), context.createSchema(s), null, (Object) null)); } schema.setFields(fields); return schema; }
Source:
public void karmaIncOrDec( ReceivePrivmsg event ) { Matcher incOrDecMatcher = incOrDecPattern.matcher( event.getText() ); if ( incOrDecMatcher.matches() ) { if ( isPrivate( event ) ) { decideIncOrDec( event, event.getSender() ); return; } if ( !event.getChannel().matches( Vilebot.getConfig().get( "ircChannel1" ) ) ) { event.reply( "You must be in " + Vilebot.getConfig().get( "ircChannel1" ) + " to give or receive karma." ); return; } String wordBlob = incOrDecMatcher.group( 0 ); String sender = BaseNick.toBaseNick( event.getSender() ); Set<String> nicks = new HashSet<String>(); Matcher nickMatcher = incOrDecBlobPattern.matcher( wordBlob ); while ( nickMatcher.find() ) { nicks.add( BaseNick.toBaseNick( nickMatcher.group( 1 ) ) ); } boolean insult = false; for ( String nick : nicks ) { if ( !nick.equals( sender ) ) decideIncOrDec( event, nick ); else insult = true; } if ( insult ) event.reply( "I think I'm supposed to insult you now." ); } }

Target:
private void karmaIncOrDec( ReceivePrivmsg event ) { Matcher incOrDecMatcher = incOrDecPattern.matcher( event.getText() ); if ( incOrDecMatcher.matches() ) { if ( isPrivate( event ) ) { KarmaDB.modNounKarma( event.getSender(), -1 ); return; } if ( !event.getChannel().matches( Vilebot.getConfig().get( "ircChannel1" ) ) ) { event.reply( "You must be in " + Vilebot.getConfig().get( "ircChannel1" ) + " to give or receive karma." ); return; } String wordBlob = incOrDecMatcher.group( 0 ); String sender = BaseNick.toBaseNick( event.getSender() ); Set<String> nicks = new HashSet<String>(); Matcher nickMatcher = incOrDecBlobPattern.matcher( wordBlob ); while ( nickMatcher.find() ) { nicks.add( BaseNick.toBaseNick( nickMatcher.group( 1 ) ) ); } boolean insult = false; for ( String nick : nicks ) { if ( !nick.equals( sender ) ) decideIncOrDec( event, nick ); else insult = true; } if ( insult ) event.reply( "I think I'm supposed to insult you now." ); } }