auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetSessionInfo() throws Exception { String hostname = ""; int session = 0; try(CallableStatement cs = methodWatcher.prepareCall("call SYSCS_UTIL.SYSCS_GET_SESSION_INFO()") ) { ResultSet rs = cs.executeQuery(); rs.next(); hostname = rs.getString("HOSTNAME"); session = rs.getInt("SESSION"); DbUtils.closeQuietly(rs); } try(CallableStatement cs2 = methodWatcher.createConnection().prepareCall("call SYSCS_UTIL.SYSCS_GET_SESSION_INFO()"); ResultSet rs2 = cs2.executeQuery() ) { rs2.next(); String hostname2 = rs2.getString("HOSTNAME"); int session2 = rs2.getInt("SESSION"); Assert.assertEquals(hostname, hostname2); Assert.assertNotEquals(session, session2); DbUtils.closeQuietly(rs2); } }

Target:
public void testGetSessionInfo() throws Exception { String hostname = ""; int session = 0; try(CallableStatement cs = methodWatcher.prepareCall("call SYSCS_UTIL.SYSCS_GET_SESSION_INFO()"); ResultSet rs = cs.executeQuery() ) { rs.next(); hostname = rs.getString("HOSTNAME"); session = rs.getInt("SESSION"); DbUtils.closeQuietly(rs); } try(CallableStatement cs2 = methodWatcher.createConnection().prepareCall("call SYSCS_UTIL.SYSCS_GET_SESSION_INFO()"); ResultSet rs2 = cs2.executeQuery() ) { rs2.next(); String hostname2 = rs2.getString("HOSTNAME"); int session2 = rs2.getInt("SESSION"); Assert.assertEquals(hostname, hostname2); Assert.assertNotEquals(session, session2); DbUtils.closeQuietly(rs2); } }
Source:
private boolean checkIfCommandIsAvailable(WR3223Commands command) throws IOException { if (disabledCommands.contains(command)) { return false; } String value = connector.read(controllerAddr, command); if (value == null || value.contains("???")) { disabledCommands.add(command); logger.warn("Command " + command + " is not supported by the controller."); return false; } return true; }

Target:
private boolean checkIfCommandIsAvailable(WR3223Commands command) throws IOException { if (disabledCommands.contains(command)) { return false; } String value = connector.read(controllerAddr, command); if (value == null || value.contains("???")) { disabledCommands.add(command); logger.warn("Command is not supported by the controller.", command); return false; } return true; }
Source:
protected void updateTemplateVersion() { if (getCluster() == null) { return; } if (getVmTemplate() == null) { return; } if (!VmVersionUpdater.isVersionUpdatePossible(getVmTemplate())) { return; } Version newVersion = CompatibilityVersionUtils.getEffective(getVmTemplate(), this::getCluster); if (newVersion.less(getCluster().getCompatibilityVersion())) { var dataCenterVersion = getStoragePool().getCompatibilityVersion(); if (newVersion.less(dataCenterVersion)) { newVersion = dataCenterVersion; } } new VmVersionUpdater(cpuFlagsManagerHandler) .updateVmtemplateToVersion(getVmTemplate(), newVersion, getCluster()); }

Target:
protected void updateTemplateVersion() { if (getCluster() == null) { return; } if (getVmTemplate() == null) { return; } if (!isTemplateVersionUpdatePossible()) { return; } Version newVersion = CompatibilityVersionUtils.getEffective(getVmTemplate(), this::getCluster); if (newVersion.less(getCluster().getCompatibilityVersion())) { var dataCenterVersion = getStoragePool().getCompatibilityVersion(); if (newVersion.less(dataCenterVersion)) { newVersion = dataCenterVersion; } } new VmVersionUpdater(cpuFlagsManagerHandler) .updateVmtemplateToVersion(getVmTemplate(), newVersion, getCluster()); }
Source:
public long getOneSidedRelationshipsCount(final ContentType contentType) throws DotDataException { DotConnect dc = new DotConnect(); dc.setSQL(sql.SELECT_ONE_SIDE_RELATIONSHIP_COUNT); dc.addParam(contentType.id()); dc.addParam(contentType.id()); List<Map<String,String>> results = dc.loadResults(); return Long.parseLong(results.get(0).get("count")); }

Target:
public long getOneSidedRelationshipsCount(final ContentType contentType) throws DotDataException { final DotConnect dc = new DotConnect(); dc.setSQL(sql.SELECT_ONE_SIDE_RELATIONSHIP_COUNT); dc.addParam(contentType.id()); dc.addParam(contentType.id()); final List<Map<String,String>> results = dc.loadResults(); return ConversionUtils.toLong(results.get(0).get("relationship_count")); }
Source:
public BaseDisk() { propagateErrors = PropagateErrors.Off; contentType = DiskContentType.DATA; }

Target:
public BaseDisk() { propagateErrors = PropagateErrors.Off; contentType = DiskContentType.DATA; diskDescription = ""; }
Source:
protected boolean uploadSegment(File segmentTarFile, SegmentUploader segmentUploader, SegmentCompletionProtocol.Request.Params params) { URI segmentLocation = segmentUploader.uploadSegment(segmentTarFile, new LLCSegmentName(params.getSegmentName())); if (segmentLocation != null) { params.withSegmentLocation(segmentLocation.toString()); return true; } return false; }

Target:
protected String uploadSegment(File segmentTarFile, SegmentUploader segmentUploader, SegmentCompletionProtocol.Request.Params params) { URI segmentLocation = segmentUploader.uploadSegment(segmentTarFile, new LLCSegmentName(params.getSegmentName())); if (segmentLocation != null) { return segmentLocation.toString(); } return null; }
Source:
private StringBuilder buildStatement() { StringBuilder buffer = new StringBuilder(); StringBuilder columnsBuffer = new StringBuilder(); for ( int i = 0; i < columns.length; i++ ) { columnsBuffer.append( columns[i] ); if ( i < columns.length - 1 ) { columnsBuffer.append( "," ); } } buffer .append( "with " ) .append( tableName ) .append( " (" ) .append( columnsBuffer ); StringBuilder parameters = new StringBuilder(); for ( Object[] result : this.ids ) { if ( parameters.length() > 0 ) { parameters.append( "," ); } parameters.append( "(" ); String[] tokens = new String[result.length]; Arrays.fill( tokens, "?" ); String tokenList = String.join( ",", Arrays.asList( tokens ) ); parameters.append( tokenList ); parameters.append( ")" ); } buffer .append( " ) as ( select " ) .append( columnsBuffer ) .append( " from ( values " ) .append( parameters ) .append( ") as HT " ) .append( "(" ) .append( columnsBuffer ) .append( ") ) " ); return buffer; }

Target:
private StringBuilder buildStatement() { StringBuilder buffer = new StringBuilder(); String columnNames = String.join(",", columns); buffer .append( "with " ) .append( tableName ) .append( " (" ) .append( columnNames ); StringBuilder parameters = new StringBuilder(); for ( Object[] result : this.ids ) { if ( parameters.length() > 0 ) { parameters.append( "," ); } parameters.append( "(" ); parameters.append( String.join( ",", Collections.nCopies( result.length, "?")) ); parameters.append( ")" ); } buffer .append( " ) as ( select " ) .append( columnNames ) .append( " from ( values " ) .append( parameters ) .append( ") as HT " ) .append( "(" ) .append( columnNames ) .append( ") ) " ); return buffer; }
Source:
protected Point getSize() { if (size == null) { size = new Point(getBaseImageData().width, getBaseImageData().height); } return size; }

Target:
protected Point getSize() { return size.get(); }
Source:
public void testRedrawAfterDispose() { LineNumberRulerColumn lineNumberRulerColumn= new LineNumberRulerColumn(); CompositeRuler ruler= new CompositeRuler(); ruler.addDecorator(0, lineNumberRulerColumn); SourceViewer sourceViewer= new SourceViewer(fParent, ruler, SWT.NONE); lineNumberRulerColumn.getControl().setSize(10, 10); sourceViewer.getTextWidget().dispose(); try { lineNumberRulerColumn.redraw(); } catch (Exception notExpected) { notExpected.printStackTrace(); fail(); } }

Target:
public void testRedrawAfterDispose() { LineNumberRulerColumn lineNumberRulerColumn= new LineNumberRulerColumn(); CompositeRuler ruler= new CompositeRuler(); ruler.addDecorator(0, lineNumberRulerColumn); SourceViewer sourceViewer= new SourceViewer(fParent, ruler, SWT.NONE); lineNumberRulerColumn.getControl().setSize(10, 10); sourceViewer.getTextWidget().dispose(); lineNumberRulerColumn.redraw(); }
Source:
public Mono<Void> deleteModel(String modelId) { try { return deleteModelWithResponse(modelId).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
public Mono<Void> deleteModel(String modelId) { return deleteModelWithResponse(modelId).flatMap(FluxUtil::toMono); }
Source:
protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) { for (VmNetworkInterface iface : getVm().getInterfaces()) { VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId()); Network network = networkHelper.getNetworkByVnicProfile(vnicProfile); if (network != null && network.isExternal() && iface.isPlugged()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); String pluginType = StringUtils.defaultString( ((OpenstackNetworkProviderProperties) provider.getAdditionalProperties()).getPluginType()); String hostBindingId = hostProviderBindingDao.get(vds.getId(), pluginType); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, iface, vds, isMigration, hostBindingId); getVm().getRuntimeDeviceCustomProperties().put( new VmDeviceId(iface.getId(), getVmId()), deviceProperties); } } }

Target:
protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) { for (VmNetworkInterface iface : getVm().getInterfaces()) { VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId()); Network network = networkHelper.getNetworkByVnicProfile(vnicProfile); if (network != null && network.isExternal() && iface.isPlugged()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); String pluginType = ((OpenstackNetworkProviderProperties) provider. getAdditionalProperties()).getPluginType(); String hostBindingId = hostProviderBindingDao.get(vds.getId(), pluginType); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, iface, vds, isMigration, hostBindingId); getVm().getRuntimeDeviceCustomProperties().put( new VmDeviceId(iface.getId(), getVmId()), deviceProperties); } } }
Source:
private File getRestoreFile() { return new File(taskConfig.getBaseTaskDir(), "restore.json"); }

Target:
private File getRestoreFile() { return new File(taskConfig.getBaseTaskDir(), TASK_RESTORE_FILENAME); }
Source:
public boolean hasLength() { return false; }

Target:
public boolean hasLength() { return true; }
Source:
public static void enableRouteOverview() { get("/debug/routeOverview/", RouteOverview::createHtmlOverview); }

Target:
public static void enableRouteOverview() { enableRouteOverview("/debug/routeoverview/"); }
Source:
private synchronized void scheduleNextRequest() { TaskStatus taskStatus = getTaskStatus(); if (!running || taskStatus.getState().isDone()) { return; } if (future != null && !future.isDone()) { log.error("Can not reschedule update because an update is already running"); return; } ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (!errorRateLimit.isDone()) { errorRateLimit.addListener(this::scheduleNextRequest, executor); return; } Request request = setBinaryTransportHeadersIfNeeded(prepareGet()) .setUri(uriBuilderFrom(taskStatus.getSelf()).appendPath("status").build()) .setHeader(PRESTO_CURRENT_STATE, taskStatus.getState().toString()) .setHeader(PRESTO_MAX_WAIT, refreshMaxWait.toString()) .build(); ResponseHandler responseHandler; if (isBinaryTransportEnabled) { responseHandler = createFullSmileResponseHandler((SmileCodec<TaskStatus>) taskStatusCodec); } else { responseHandler = createAdaptingJsonResponseHandler(unwrapJsonCodec(taskStatusCodec)); } errorTracker.startRequest(); future = httpClient.executeAsync(request, responseHandler); currentRequestStartNanos.set(System.nanoTime()); Futures.addCallback(future, new SimpleHttpResponseHandler<>(this, request.getUri(), stats), executor); }

Target:
private synchronized void scheduleNextRequest() { TaskStatus taskStatus = getTaskStatus(); if (!running || taskStatus.getState().isDone()) { return; } if (future != null && !future.isDone()) { log.error("Can not reschedule update because an update is already running"); return; } ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (!errorRateLimit.isDone()) { errorRateLimit.addListener(this::scheduleNextRequest, executor); return; } Request request = setContentTypeHeaders(isBinaryTransportEnabled, prepareGet()) .setUri(uriBuilderFrom(taskStatus.getSelf()).appendPath("status").build()) .setHeader(PRESTO_CURRENT_STATE, taskStatus.getState().toString()) .setHeader(PRESTO_MAX_WAIT, refreshMaxWait.toString()) .build(); ResponseHandler responseHandler; if (isBinaryTransportEnabled) { responseHandler = createFullSmileResponseHandler((SmileCodec<TaskStatus>) taskStatusCodec); } else { responseHandler = createAdaptingJsonResponseHandler(unwrapJsonCodec(taskStatusCodec)); } errorTracker.startRequest(); future = httpClient.executeAsync(request, responseHandler); currentRequestStartNanos.set(System.nanoTime()); Futures.addCallback(future, new SimpleHttpResponseHandler<>(this, request.getUri(), stats), executor); }
Source:
private void processEvents() { try { while ( !Thread.currentThread().isInterrupted() && (state.get() == State.STARTED) ) { int pollMaxMs = (sessionTimeoutMs * 2) / 3; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( checkSessionExpiration ) { synchronized(this) { checkSessionExpiration(); } } } } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } }

Target:
private void processEvents() { try { while ( !Thread.currentThread().isInterrupted() && (state.get() == State.STARTED) ) { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; int pollMaxMs = (useSessionTimeoutMs * 2) / 3; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( checkSessionExpiration ) { synchronized(this) { checkSessionExpiration(); } } } } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); } }
Source:
public List<Job> pop(final int count) throws IOException { final Object result = this.client.call( LuaCommand.POP.toString(), this.name, this.client.workerName(), Integer.toString(count)); if (result.equals(ClientHelper.EMPTY_RESULT)) { return new ArrayList<Job>(); } final InjectableValues injectables = new InjectableValues.Std().addValue("client", this.client); final JavaType javaType = new ObjectMapper().getTypeFactory() .constructCollectionType(ArrayList.class, Job.class); return JsonUtils.parse(result.toString(), javaType, injectables); }

Target:
public List<Job> pop(final int count) throws IOException { final Object result = this.client.call( LuaCommand.POP.toString(), this.name, this.client.workerName(), Integer.toString(count)); if (result.equals(ClientHelper.EMPTY_RESULT)) { return Collections.emptyList(); } final InjectableValues injectables = new InjectableValues.Std().addValue("client", this.client); final JavaType javaType = new ObjectMapper().getTypeFactory() .constructCollectionType(ArrayList.class, Job.class); return JsonUtils.parse(result.toString(), javaType, injectables); }
Source:
private Object createObjectFromFullModuleNames(String name, Set<String> fullModuleNames) throws CheckstyleException { if (fullModuleNames.size() == 1) { return createObject(fullModuleNames.iterator().next()); } else { final String optionalNames = fullModuleNames.stream() .reduce((fullNames, fullName) -> fullNames + STRING_SEPARATOR + fullName).get(); final LocalizedMessage exceptionMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE, new String[] {name, optionalNames}, null, getClass(), null); throw new CheckstyleException(exceptionMessage.getMessage()); } }

Target:
private Object createObjectFromFullModuleNames(String name, Set<String> fullModuleNames) throws CheckstyleException { final Object returnValue; if (fullModuleNames.size() == 1) { returnValue = createObject(fullModuleNames.iterator().next()); } else { final String optionalNames = fullModuleNames.stream() .sorted() .collect(Collectors.joining(STRING_SEPARATOR)); final LocalizedMessage exceptionMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE, new String[] {name, optionalNames}, null, getClass(), null); throw new CheckstyleException(exceptionMessage.getMessage()); } return returnValue; }
Source:
public List<ChePlugin> execute() throws InfrastructureException { LOG.debug("Starting brokers pod for workspace '{}'", workspaceId); Span tracingSpan = startTracingPhase(); KubernetesDeployments deployments = namespace.deployments(); try { for (ConfigMap configMap : brokerEnvironment.getConfigMaps().values()) { namespace.configMaps().create(configMap); } Pod pluginBrokerPod = getPluginBrokerPod(brokerEnvironment.getPodsCopy()); if (factory.isConfigured()) { UnrecoverablePodEventListener unrecoverableEventListener = factory.create( ImmutableSet.of(pluginBrokerPod.getMetadata().getName()), this::handleUnrecoverableEvent); namespace.deployments().watchEvents(unrecoverableEventListener); } deployments.create(pluginBrokerPod); LOG.debug("Brokers pod is created for workspace '{}'", workspaceId); finishSpanIfExists(tracingSpan); return nextPhase.execute(); } finally { namespace.deployments().stopWatch(); try { deployments.delete(); } catch (InfrastructureException e) { LOG.error("Brokers pod removal failed. Error: " + e.getLocalizedMessage(), e); } try { namespace.configMaps().delete(); } catch (InfrastructureException ex) { LOG.error("Brokers config map removal failed. Error: " + ex.getLocalizedMessage(), ex); } } }

Target:
public List<ChePlugin> execute() throws InfrastructureException { LOG.debug("Starting brokers pod for workspace '{}'", workspaceId); Span tracingSpan = tracerUtil.buildSpan(SPAN_NAME, null, workspaceId, null); KubernetesDeployments deployments = namespace.deployments(); try { for (ConfigMap configMap : brokerEnvironment.getConfigMaps().values()) { namespace.configMaps().create(configMap); } Pod pluginBrokerPod = getPluginBrokerPod(brokerEnvironment.getPodsCopy()); if (factory.isConfigured()) { UnrecoverablePodEventListener unrecoverableEventListener = factory.create( ImmutableSet.of(pluginBrokerPod.getMetadata().getName()), this::handleUnrecoverableEvent); namespace.deployments().watchEvents(unrecoverableEventListener); } deployments.create(pluginBrokerPod); LOG.debug("Brokers pod is created for workspace '{}'", workspaceId); tracerUtil.finishSpan(tracingSpan); return nextPhase.execute(); } catch (InfrastructureException e) { tracerUtil.finishSpanAsFailure(tracingSpan, e.getMessage()); throw e; } finally { namespace.deployments().stopWatch(); try { deployments.delete(); } catch (InfrastructureException e) { LOG.error("Brokers pod removal failed. Error: " + e.getLocalizedMessage(), e); } try { namespace.configMaps().delete(); } catch (InfrastructureException ex) { LOG.error("Brokers config map removal failed. Error: " + ex.getLocalizedMessage(), ex); } } }
Source:
public void deleteRejectedOrPendingOrganization( @Parameter(hidden = true, name = "user") @Auth User user, @Parameter(description = "Organization ID.", name = "organizationId", in = ParameterIn.PATH, required = true) @PathParam("organizationId") Long organizationId) { Organization organization = organizationDAO.findById(organizationId); OrganizationUser orgUser = getUserOrgRole(organization, user.getId()); if ((orgUser == null || orgUser.getRole() != OrganizationUser.Role.MAINTAINER) && (!user.isCurator() && !user.getIsAdmin())) { throw new CustomWebApplicationException("You do not have access to delete this organization", HttpStatus.SC_FORBIDDEN); } if (organization.getStatus() == Organization.ApplicationState.PENDING || organization.getStatus() == Organization.ApplicationState.REJECTED) { organization.getStarredUsers().clear(); organization.getAliases().clear(); eventDAO.deleteEventByOrganizationID(organizationId); organizationDAO.update(organization); organizationDAO.delete(organization); } else { throw new CustomWebApplicationException("You cannot delete an organization that is not currently pending or rejected", HttpStatus.SC_BAD_REQUEST); } }

Target:
public void deleteRejectedOrPendingOrganization( @Parameter(hidden = true, name = "user") @Auth User user, @Parameter(description = "Organization ID.", name = "organizationId", in = ParameterIn.PATH, required = true) @PathParam("organizationId") Long organizationId) { Organization organization = organizationDAO.findById(organizationId); OrganizationUser orgUser = getUserOrgRole(organization, user.getId()); if ((orgUser == null || orgUser.getRole() != OrganizationUser.Role.MAINTAINER) && (!user.isCurator() && !user.getIsAdmin())) { throw new CustomWebApplicationException("You do not have access to delete this organization", HttpStatus.SC_FORBIDDEN); } if (organization.getStatus() == Organization.ApplicationState.PENDING || organization.getStatus() == Organization.ApplicationState.REJECTED) { eventDAO.deleteEventByOrganizationID(organizationId); organizationDAO.delete(organization); } else { throw new CustomWebApplicationException("You can only delete organizations that are pending or have been rejected", HttpStatus.SC_BAD_REQUEST); } }
Source:
protected Map<String, GlusterVolumeEntity> fetchVolumes(VDS upServer) { VDSReturnValue result = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterVolumesList, new GlusterVolumesListVDSParameters(upServer.getId(), upServer.getvds_group_id())); return result.getSucceeded() ? (Map<String, GlusterVolumeEntity>) result.getReturnValue() : null; }

Target:
protected Map<String, GlusterVolumeEntity> fetchVolumes(VDS upServer) { VDSReturnValue result = runVdsCommand(VDSCommandType.GlusterVolumesList, new GlusterVolumesListVDSParameters(upServer.getId(), upServer.getvds_group_id())); return result.getSucceeded() ? (Map<String, GlusterVolumeEntity>) result.getReturnValue() : null; }
Source:
public void initializeDefaultPreferences() { IPreferenceStore pstore = CDebugUIPlugin.getDefault().getPreferenceStore(); CDebugPreferencePage.initDefaults( pstore ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_NO_SOURCE_INFO, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_SOURCE_NOT_FOUND, false ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_HARDWARE, ICDebugPreferenceConstants.PREF_REVERSE_TRACE_METHOD_GDB_TRACE); }

Target:
public void initializeDefaultPreferences() { IPreferenceStore pstore = CDebugUIPlugin.getDefault().getPreferenceStore(); CDebugPreferencePage.initDefaults( pstore ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_NO_SOURCE_INFO, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_OPEN_SOURCE_NOT_FOUND, false ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS, true ); pstore.setDefault( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE, true ); pstore.setDefault(ICDebugPreferenceConstants.PREF_SHOW_ERROR_REVERSE_TRACE_METHOD_NOT_AVAILABLE, true); }
Source:
public void ensureV3CertificateCreationOkWhenConsumerSupportsV3Dot1Certs() throws Exception { consumer.setFact("system.certificate_version", "3.4"); subscription.getProduct().setAttribute(Product.Attributes.RAM, "4"); subscription.getProduct().setAttribute(Product.Attributes.ROLES, "role1, role2 "); DefaultEntitlementCertServiceAdapter entAdapter = this.initCertServiceAdapter(); entAdapter.createX509Certificate(consumer, owner, pool, entitlement, product, new HashSet<>(), getProductModels(product, new HashSet<>(), "prefix", entitlement), new BigInteger("1234"), keyPair, true); }

Target:
public void ensureV3CertificateCreationOkWhenConsumerSupportsV3Dot1Certs() throws Exception { consumer.setFact("system.certificate_version", X509V3ExtensionUtil.CERT_VERSION); subscription.getProduct().setAttribute(Product.Attributes.RAM, "4"); subscription.getProduct().setAttribute(Product.Attributes.ROLES, "role1, role2 "); DefaultEntitlementCertServiceAdapter entAdapter = this.initCertServiceAdapter(); entAdapter.createX509Certificate(consumer, owner, pool, entitlement, product, new HashSet<>(), getProductModels(product, new HashSet<>(), "prefix", entitlement), new BigInteger("1234"), keyPair, true); }
Source:
void setLastSearchTime() { LocalDate date = LocalDate.now(); testStudy.setLastSearchDate(date); Assertions.assertEquals(date.toString(), testStudy.getStudyMetaDataField(StudyMetaDataField.STUDY_LAST_SEARCH).get()); }

Target:
void setLastSearchTime() { LocalDate date = LocalDate.now(); testStudy.setLastSearchDate(date); assertEquals(date.toString(), testStudy.getStudyMetaDataField(StudyMetaDataField.STUDY_LAST_SEARCH).get()); }
Source:
private Response executeProcessAlarmAction(String idOperation, Event params) throws CapabilityException { IAction action = createAction(idOperation); action.setParams(params); action.setModelToUpdate(resource.getModel()); log.debug("Executing process alarm action"); return executeAction(action, idOperation); }

Target:
private Response executeProcessAlarmAction(String idOperation, Event params) throws CapabilityException { IAction action = createActionAndCheckParams(idOperation, params); action.setParams(params); action.setModelToUpdate(resource.getModel()); log.debug("Executing process alarm action"); return executeAction(action, idOperation); }
Source:
public void testUpdate() throws CoreException { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); TaskData reviewData1 = addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.addTaskAssocation(review1, reviewData1); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); when(review1.getAttribute(TaskReviewsMappingsStore.ATTR_ASSOCIATED_TASK)).thenReturn(taskUrl1); reviewData1 = addReviewData(review1, descriptionWithTaskUrl2); taskReviewsMappingStore.addTaskAssocation(review1, reviewData1); delta = new TaskContainerDelta(review1, Kind.CONTENT); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertFalse(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl2).contains(reviewUrl1)); }

Target:
public void testUpdate() throws CoreException { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); TaskData reviewData1 = addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.addTaskAssocation(review1, reviewData1); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); reviewData1 = addReviewData(review1, descriptionWithTaskUrl2); delta = new TaskContainerDelta(review1, Kind.CONTENT); taskReviewsMappingStore.addTaskAssocation(review1, reviewData1); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertFalse(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl2).contains(reviewUrl1)); }
Source:
public void doWrite(BaseRow row, int ordinal) { if (row.isNullAt(ordinal)) { ((DecimalVector) getValueVector()).setNull(getCount()); } else { ((DecimalVector) getValueVector()).setSafe( getCount(), row.getDecimal(ordinal, precision, scale).toBigDecimal()); } }

Target:
public void doWrite(BaseRow row, int ordinal) { if (row.isNullAt(ordinal)) { ((DecimalVector) getValueVector()).setNull(getCount()); } else { BigDecimal bigDecimal = row.getDecimal(ordinal, precision, scale).toBigDecimal(); bigDecimal = fromBigDecimal(bigDecimal, precision, scale); if (bigDecimal == null) { ((DecimalVector) getValueVector()).setNull(getCount()); } else { ((DecimalVector) getValueVector()).setSafe(getCount(), bigDecimal); } } }
Source:
public void applyPattern(String pattern) { icuDecimalFormat.applyPattern(pattern); updateFieldsFromIcu(); icuDecimalFormat.setPositivePrefix(icuDecimalFormat.getPositivePrefix()); icuDecimalFormat.setPositiveSuffix(icuDecimalFormat.getPositiveSuffix()); icuDecimalFormat.setNegativePrefix(icuDecimalFormat.getNegativePrefix()); icuDecimalFormat.setNegativeSuffix(icuDecimalFormat.getNegativeSuffix()); icuDecimalFormat.setGroupingSize(icuDecimalFormat.getGroupingSize()); icuDecimalFormat.setRoundingMode(convertRoundingMode(roundingMode)); icuDecimalFormat.setMaximumIntegerDigits(icuDecimalFormat.getMaximumIntegerDigits()); icuDecimalFormat.setMinimumIntegerDigits(icuDecimalFormat.getMinimumIntegerDigits()); icuDecimalFormat.setMaximumFractionDigits(icuDecimalFormat.getMaximumFractionDigits()); icuDecimalFormat.setMinimumFractionDigits(icuDecimalFormat.getMinimumFractionDigits()); }

Target:
public void applyPattern(String pattern) { icuDecimalFormat.applyPattern(pattern); updateFieldsFromIcu(); }
Source:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getVdsmTaskIdList().add(taskId); getReturnValue().getInternalVdsmTaskIdList().add(taskId); getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getVdsmTaskIdList().add(taskId); getReturnValue().getInternalVdsmTaskIdList().add(taskId); getParameters().setVdsmTaskIds(new ArrayList<>(List.of(taskId))); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }
Source:
public Object visit(final AntlrBaseNode node) { return node.accept(this); }

Target:
public T visit(final AntlrBaseNode node) { return node.accept(this); }
Source:
public void close() throws SecurityException { for (ExtensionProxy extension : getExtensions()) { extension.invoke(new ExtMap() .mput(Base.InvokeKeys.COMMAND, Base.InvokeCommands.TERMINATE)); } }

Target:
public void close() throws SecurityException { Iterator<ExtensionProxy> iter = getExtensions().iterator(); while (iter.hasNext()) { ExtensionProxy extension = iter.next(); extension.invoke(new ExtMap() .mput(Base.InvokeKeys.COMMAND, Logger.InvokeCommands.CLOSE)); } }
Source:
private String encodeArrayValue(final Object value) { final int length = Array.getLength(value); if(length == 0){ return ""; } final StringBuilder ret = new StringBuilder(Array.get(value, 0).toString()); for (int i = 1; i < length; ++i) { ret.append(','); ret.append(Array.get(value, i).toString()); } return ret.toString(); }

Target:
private static String encodeArrayValue(final Object value) { final int length = Array.getLength(value); final StringBuilder ret = new StringBuilder(); for (int i = 0; i < length; ++i) { ret.append(','); ret.append(Array.get(value, i).toString()); } return ret.toString(); }
Source:
public static void resetInstance() { instance = null; SecureRandom random = new SecureRandom(); Realm realm = Realm.getInstance(configuration); UserFactoryStore store = realm.where(UserFactoryStore.class).findFirst(); realm.beginTransaction(); if (store == null) { store = realm.createObject(UserFactoryStore.class); } store.setUserName(new BigInteger(130, random).toString(32)); realm.commitTransaction(); realm.close(); }

Target:
public static void resetInstance() { instance = null; Realm realm = Realm.getInstance(configuration); UserFactoryStore store = realm.where(UserFactoryStore.class).findFirst(); realm.beginTransaction(); if (store == null) { store = realm.createObject(UserFactoryStore.class); } store.setUserName(UUID.randomUUID().toString()); realm.commitTransaction(); realm.close(); }
Source:
private void loadMergeBranchComponents() { String mergeBranchUuid = analysisMetadataHolder.getBranch().get().getMergeBranchUuid().get(); uuidsByKey = new HashMap<>(); try (DbSession dbSession = dbClient.openSession(false)) { List<ComponentDto> components = dbClient.componentDao().selectByProjectUuid(mergeBranchUuid, dbSession); for (ComponentDto dto : components) { uuidsByKey.put(removeBranchFromKey(dto.getDbKey()), dto.uuid()); } } }

Target:
private void loadMergeBranchComponents() { String mergeBranchUuid = analysisMetadataHolder.getBranch().get().getMergeBranchUuid().get(); uuidsByKey = new HashMap<>(); try (DbSession dbSession = dbClient.openSession(false)) { List<ComponentDto> components = dbClient.componentDao().selectByProjectUuid(mergeBranchUuid, dbSession); for (ComponentDto dto : components) { uuidsByKey.put(dto.getKey(), dto.uuid()); } } }
Source:
public static boolean compareTypesById(DataType<?> left, DataType<?> right) { if (left.id() != right.id()) { return false; } else if (isArray(left)) { return compareTypesById(unnest(left), unnest(right)); } else { return true; } }

Target:
public static boolean compareTypesById(DataType<?> left, DataType<?> right) { if (left.id() != right.id()) { return false; } else if (isArray(left)) { return compareTypesById( ((ArrayType) left).innerType(), ((ArrayType) right).innerType()); } else { return true; } }
Source:
public void onTestSuccess(ITestResult result) { long time = System.currentTimeMillis(); TestNgRunStateTracker.logEvent( TestNgRunStateTracker.EventLog.builder() .setEvent(TestNgRunStateTracker.TestNgRunEvent.LISTENER_TEST_METHOD_PASS) .setTimeOfEvent(time) .setThreadId(Thread.currentThread().getId()) .addData(TestNgRunStateTracker.EventInfo.METHOD_NAME, result.getMethod().getMethodName()) .addData(TestNgRunStateTracker.EventInfo.CLASS_NAME, result.getMethod().getRealClass() .getCanonicalName()) .addData(TestNgRunStateTracker.EventInfo.CLASS_INSTANCE, result.getMethod().getInstance()) .addData(TestNgRunStateTracker.EventInfo.TEST_NAME, result.getTestContext().getName()) .addData(TestNgRunStateTracker.EventInfo.SUITE_NAME, result.getTestContext().getSuite() .getName()) .build() ); try { TimeUnit.SECONDS.sleep(1); } catch(InterruptedException e) { throw new RuntimeException("Problem with delaying after test method listener onTestSuccess", e); } }

Target:
public void onTestSuccess(ITestResult result) { logEvent(buildEventLog(result, LISTENER_TEST_METHOD_PASS).build()); delayAfterEvent(LISTENER_TEST_METHOD_PASS); }
Source:
public boolean supportsColumnStatistics() { return false; }

Target:
public boolean supportsColumnStatistics() { return true; }
Source:
public void startNextActivity() { Toast.makeText(this, "Logged in Successfully", Toast.LENGTH_SHORT).show(); startActivity(new Intent(this, DashboardActivity.class)); }

Target:
public void startNextActivity() { Toast.makeText(this, R.string.Log_in_success, Toast.LENGTH_SHORT).show(); startActivity(new Intent(this, DashboardActivity.class)); }
Source:
public <T> void addListener(T observer, RealmChangeListener<T> listener) { if (observerPairs.isEmpty()) { nativeStartListening(nativePtr); } CollectionObserverPair<T> collectionObserverPair = new CollectionObserverPair<>(observer, listener); observerPairs.add(collectionObserverPair); }

Target:
public <T> void addListener(T observer, RealmChangeListener<T> listener) { addListener(observer, new RealmChangeListenerWrapper<T>(listener)); }
Source:
public void testSupportHandlerManager() { SupportHandlerManager handlerManager = new SupportHandlerManager(); SupportProviderManager providerManager = new SupportProviderManager(); SupportProduct product = providerManager.getProduct("org.eclipse.mylyn.tasks.tests.product1"); IStatus status = new ProductStatus(product); SupportRequest request = new SupportRequest(providerManager, status, product); handlerManager.preProcess(request); assertTrue(((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()); IProgressMonitor monitor = new NullOperationMonitor(); handlerManager.process(request.getDefaultContribution(), monitor); assertNotNull(request.getDefaultContribution()); AttributeTaskMapper mapper = ((AttributeTaskMapper) request.getDefaultContribution()); assertTrue(!mapper.isHandled()); TaskData taskData = null; try { taskData = mapper.createTaskData(monitor); } catch (CoreException e) { fail("unexpected CoreException " + e.getMessage()); } assertNotNull(taskData); mapper.setTaskData(taskData); handlerManager.postProcess(mapper, monitor); TaskAttribute serv = taskData.getRoot().getAttribute("bug_severity"); assertEquals("enhancement", serv.getValue()); }

Target:
public void testSupportHandlerManager() { SupportHandlerManager handlerManager = new SupportHandlerManager(); SupportProviderManager providerManager = new SupportProviderManager(); SupportProduct product = providerManager.getProduct("org.eclipse.mylyn.tasks.tests.productnormal"); IStatus status = new ProductStatus(product); SupportRequest request = new SupportRequest(providerManager, status, product); handlerManager.preProcess(request); assertTrue(((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()); IProgressMonitor monitor = new NullOperationMonitor(); handlerManager.process(request.getDefaultContribution(), monitor); assertNotNull(request.getDefaultContribution()); AttributeTaskMapper mapper = ((AttributeTaskMapper) request.getDefaultContribution()); assertTrue(!mapper.isHandled()); TaskData taskData = null; try { taskData = mapper.createTaskData(monitor); } catch (CoreException e) { fail("unexpected CoreException " + e.getMessage()); } assertNotNull(taskData); mapper.setTaskData(taskData); handlerManager.postProcess(mapper, monitor); TaskAttribute serv = taskData.getRoot().getMappedAttribute(TaskAttribute.SEVERITY); assertEquals("enhancement", serv.getValue()); }
Source:
public void pullImage(String dockerServerURI, String register, String imageName) { DockerExplorer de = this; de.open(); de.getConnection(dockerServerURI); new ContextMenu("Pull...").select(); new WaitUntil(new ShellWithTextIsAvailable("Pull Image"), TimePeriod.NORMAL); String fullRegisterName = register; Combo combo = new DefaultCombo(); combo.setSelection(fullRegisterName); new LabeledText(IMAGE_NAME).setFocus(); new LabeledText(IMAGE_NAME).setText(imageName); new PushButton("Finish").click(); AbstractWait.sleep(TimePeriod.getCustom(5)); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); }

Target:
public void pullImage(String dockerServerURI, String register, String imageName) { DockerExplorer de = this; de.open(); de.getConnection(dockerServerURI); new ContextMenu("Pull...").select(); new WaitUntil(new ShellWithTextIsAvailable("Pull Image"), TimePeriod.NORMAL); Combo combo = new DefaultCombo(); combo.setSelection(register); new LabeledText(IMAGE_NAME).setFocus(); new LabeledText(IMAGE_NAME).setText(imageName); new PushButton("Finish").click(); AbstractWait.sleep(TimePeriod.getCustom(5)); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); }
Source:
private void invokeServlet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setHeader("Strict-Transport-Security", "max-age=31536000"); log.info("Request received: [" + req.getMethod() + "] " + req.getRequestURL().toString() + ", Params: " + HttpRequestHelper.getRequestParametersAsString(req) + ", Headers: " + HttpRequestHelper.getRequestHeadersAsString(req) + ", Request ID: " + Config.getRequestId()); Action action; try { action = new ActionFactory().getAction(req, req.getMethod(), resp); } catch (ActionMappingException e) { throwError(resp, e.getStatusCode(), e.getMessage()); return; } catch (UnauthorizedAccessException uae) { throwError(resp, HttpStatus.SC_FORBIDDEN, uae.getMessage()); return; } try { action.checkAccessControl(); ActionResult result = action.execute(); result.send(resp); } catch (InvalidHttpParameterException ihpe) { throwError(resp, HttpStatus.SC_BAD_REQUEST, ihpe.getMessage()); } catch (UnauthorizedAccessException uae) { throwError(resp, HttpStatus.SC_FORBIDDEN, uae.getMessage()); } catch (EntityNotFoundException enfe) { throwError(resp, HttpStatus.SC_NOT_FOUND, enfe.getMessage()); } catch (DeadlineExceededException | DatastoreTimeoutException e) { log.severe(e.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(e)); throwError(resp, HttpStatus.SC_GATEWAY_TIMEOUT, e.getMessage()); } catch (Throwable t) { log.severe(t.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(t)); throwError(resp, HttpStatus.SC_INTERNAL_SERVER_ERROR, t.getMessage()); } }

Target:
private void invokeServlet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setHeader("Strict-Transport-Security", "max-age=31536000"); log.info("Request received: [" + req.getMethod() + "] " + req.getRequestURL().toString() + ", Params: " + HttpRequestHelper.getRequestParametersAsString(req) + ", Headers: " + HttpRequestHelper.getRequestHeadersAsString(req) + ", Request ID: " + Config.getRequestId()); try { Action action = new ActionFactory().getAction(req, req.getMethod(), resp); action.checkAccessControl(); ActionResult result = action.execute(); result.send(resp); } catch (ActionMappingException e) { throwError(resp, e.getStatusCode(), e.getMessage()); } catch (InvalidHttpParameterException ihpe) { throwError(resp, HttpStatus.SC_BAD_REQUEST, ihpe.getMessage()); } catch (UnauthorizedAccessException uae) { throwError(resp, HttpStatus.SC_FORBIDDEN, uae.getMessage()); } catch (EntityNotFoundException enfe) { throwError(resp, HttpStatus.SC_NOT_FOUND, enfe.getMessage()); } catch (DeadlineExceededException | DatastoreTimeoutException e) { log.severe(e.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(e)); throwError(resp, HttpStatus.SC_GATEWAY_TIMEOUT, e.getMessage()); } catch (Throwable t) { log.severe(t.getClass().getSimpleName() + " caught by WebApiServlet: " + TeammatesException.toStringWithStackTrace(t)); throwError(resp, HttpStatus.SC_INTERNAL_SERVER_ERROR, t.getMessage()); } }
Source:
public void showPrimary(StatePrimaryResponse.StatePrimary[] states, ApiAddress apiAddress) { StatePrimaryResponse.StatePrimary userState = null; for (int i = 0; i < states.length; i++) { if (states[i].getCode().equalsIgnoreCase(apiAddress.attributes().state())) { userState = states[i]; break; } } if (userState == null) { Timber.e("Unable to extract state primary"); return; } Context context = getContext(); String name = userState.getState(); String packageName = context.getPackageName(); int resId = getResources().getIdentifier(name.toLowerCase(), "drawable", packageName); Drawable img = context.getResources().getDrawable(resId); if (img != null){ primariesButton.setCompoundDrawablesWithIntrinsicBounds( img, null, null, null ); } primariesButton.setText(name); }

Target:
public void showPrimary(StatePrimaryResponse.StatePrimary[] states, ApiAddress apiAddress) { StatePrimaryResponse.StatePrimary userState = null; for (int i = 0; i < states.length; i++) { if (states[i].getCode().equalsIgnoreCase(apiAddress.attributes().state())) { userState = states[i]; break; } } if (userState == null) { Timber.e("Unable to extract state primary"); return; } Context context = getContext(); String name = userState.getState(); if (name != null) { String stateName = name.toLowerCase(); if (stateName.equalsIgnoreCase("new york")) { stateName = "new_york"; } else if (stateName.equalsIgnoreCase("new jersey")) { stateName = "new_jersey"; } else if (stateName.equalsIgnoreCase("new hampshire")) { stateName = "new_hampshire"; } else if (stateName.equalsIgnoreCase("new mexico")) { stateName = "new_mexico"; } else if (stateName.equalsIgnoreCase("north carolina")) { stateName = "north_carolina"; } else if (stateName.equalsIgnoreCase("north dakota")) { stateName = "north_dakota"; } else if (stateName.equalsIgnoreCase("south carolina")) { stateName = "south_carolina"; } else if (stateName.equalsIgnoreCase("south dakota")) { stateName = "south_dakota"; } else if (stateName.equalsIgnoreCase("west virginia")) { stateName = "west_virginia"; } else if (stateName.equalsIgnoreCase("rhode island")) { stateName = "rhode_island"; } String packageName = context.getPackageName(); int resId = getResources().getIdentifier(stateName, "drawable", packageName); Drawable img = context.getResources().getDrawable(resId); if (img != null) { primariesButton.setCompoundDrawablesWithIntrinsicBounds(img, null, null, null); } } primariesButton.setText(name); }
Source:
@Override public void writeString(String val) { if (val != null) { if (buf.capacity() < val.length()) { if (stringsMap == null) stringsMap = new HashMap<>(); byte[] bytes = stringsMap.computeIfAbsent(val, s -> s.getBytes()); try { writeByteArray(bytes); } catch (Exception e) { stringsMap.remove(val); throw e; } if (lastFinished) stringsMap.remove(val); } else writeByteArray(val.getBytes()); } else writeByteArray(null); }

Target:
@Override public void writeString(String val) { if (val != null) { if (curStrBackingArr == null) curStrBackingArr = val.getBytes(); writeByteArray(curStrBackingArr); if (lastFinished) curStrBackingArr = null; } else writeByteArray(null); }
Source:
public List<Object> configurations() { return Collections.singletonList(new TooManyLinesInFileCheck.Config(maximum)); }

Target:
public List<Object> configurations() { return Collections.singletonList(new Config(maximum)); }
Source:
public String getText(Object object) { String label = ((ValidationRule) object).getName(); return label == null || label.length() == 0 ? getString("_UI_ValidationRule_type") : getString("_UI_ValidationRule_type") + " " + label; }

Target:
public String getText(Object object) { IdentifiedElementQuery query = new IdentifiedElementQuery((SemanticValidationRule) object); String label = query.getLabel(); return label == null || label.length() == 0 ? getString("_UI_ValidationRule_type") : getString("_UI_ValidationRule_type") + " " + label; }