auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void saveAllResources(ResourceSet resourceSet, Map<?, ?> options, StorageTraversal leftTraversal, StorageTraversal rightTraversal, StorageTraversal originTraversal) { EList<Resource> resources = resourceSet.getResources(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final Set<Resource> wsResources = Sets.newHashSet(); final Set<Resource> nonWsResources = Sets.newHashSet(); for (Resource resource : resources) { String projectName = new <START> Path(resource.getURI().toPlatformString(true)).segment(0); <END> IProject project = root.getProject(projectName); if (project != null && project.isAccessible()) { wsResources.add(resource); } else { nonWsResources.add(resource); } } for (Resource resource : wsResources) { saveResource(resource, options); } resources.removeAll(wsResources); for (Resource resource : nonWsResources) { String absolutePath = getAbsolutePath(resource, leftTraversal, rightTraversal, originTraversal); URI fileURI = URI.createFileURI(absolutePath); resource.setURI(fileURI); } for (Resource resource : nonWsResources) { saveResource(resource, options); } }</code><technical_language>This return null for non-platform URIs</technical_language>

Target:
public static void saveAllResources(ResourceSet resourceSet, Map<?, ?> options, StorageTraversal leftTraversal, StorageTraversal rightTraversal, StorageTraversal originTraversal) { List<Resource> resources = Lists.newArrayList(Iterables.filter(resourceSet.getResources(), new Predicate<Resource>() { public boolean apply(Resource input) { return supportsOutput(input); } })); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final Set<Resource> wsResources = Sets.newHashSet(); final Set<Resource> nonWsResources = Sets.newHashSet(); for (Resource resource : resources) { String projectName = new Path(resource.getURI().toPlatformString(true)).segment(0); IProject project = root.getProject(projectName); if (project != null && project.isAccessible()) { wsResources.add(resource); } else { nonWsResources.add(resource); } } for (Resource resource : wsResources) { saveResource(resource, options); } resources.removeAll(wsResources); for (Resource resource : nonWsResources) { String absolutePath = getAbsolutePath(resource, leftTraversal, rightTraversal, originTraversal); URI fileURI = URI.createFileURI(absolutePath); resource.setURI(fileURI); } for (Resource resource : nonWsResources) { saveResource(resource, options); } }
Source:
<code><START> public SearchServiceClientBuilder endpoint(String endpoint) { <END> this.endpoint = endpoint; return this; }</code><technical_language>Generally endpoint is checked for null if is exception is thrown</technical_language>

Target:
public SearchServiceClientBuilder endpoint(String endpoint) { try { new URL(endpoint); } catch (MalformedURLException ex) { throw logger.logExceptionAsWarning(new IllegalArgumentException("'endpoint' must be a valid URL")); } this.endpoint = endpoint; return this; }
Source:
<code>public Builder(RetryConfig baseConfig) { this.maxAttempts = baseConfig.maxAttempts; <START> this.retryOnExceptionPredicate = baseConfig.retryOnExceptionPredicate; <END> this.retryOnResultPredicate = baseConfig.retryOnResultPredicate; this.intervalBiFunction = baseConfig.intervalBiFunction; this.retryExceptions = baseConfig.retryExceptions; this.ignoreExceptions = baseConfig.ignoreExceptions; }</code><technical_language>) fix message :)</technical_language>

Target:
public Builder(RetryConfig baseConfig) { this.maxAttempts = baseConfig.maxAttempts; this.retryOnExceptionPredicate = baseConfig.retryOnExceptionPredicate; this.retryOnResultPredicate = baseConfig.retryOnResultPredicate; this.retryExceptions = baseConfig.retryExceptions; this.ignoreExceptions = baseConfig.ignoreExceptions; if (baseConfig.intervalFunction != null) { this.intervalFunction = baseConfig.intervalFunction; } else { this.intervalBiFunction = baseConfig.intervalBiFunction; } }
Source:
<code>private int initializeAppResources(CommCareApp app) { try { currentApp = app; <START> currentApp.initializeStylizer(); <END> if(currentApp.initializeApplication()) { return STATE_READY; } else { return STATE_CORRUPTED; } } catch(Exception e) { Log.i("FAILURE", "Problem with loading"); Log.i("FAILURE", "E: " + e.getMessage()); e.printStackTrace(); ExceptionReportTask ert = new ExceptionReportTask(); ert.execute(e); return STATE_CORRUPTED; } }</code><technical_language>Is thre a reason this call app initialization below</technical_language>

Target:
private int initializeAppResources(CommCareApp app) { try { currentApp = app; if (currentApp.initializeApplication()) { return STATE_READY; } else { return STATE_CORRUPTED; } } catch (Exception e) { Log.i("FAILURE", "Problem with loading"); Log.i("FAILURE", "E: " + e.getMessage()); e.printStackTrace(); ExceptionReportTask ert = new ExceptionReportTask(); ert.execute(e); return STATE_CORRUPTED; } }
Source:
<code>public DataNode(Datacenter datacenter, JSONObject jsonObject, ClusterMapConfig clusterMapConfig) throws JSONException { if (logger.isTraceEnabled()) { logger.trace("DataNode " + jsonObject.toString()); } this.datacenter = datacenter; this.hostname = getFullyQualifiedDomainName(jsonObject.getString("hostname")); this.port = jsonObject.getInt("port"); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils .getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.valueOf(jsonObject.getString("hardwareState")), clusterMapConfig); this.dataNodeStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a datanode " + e); throw new IllegalStateException( "Error creating resource state policy when instantiating a datanode: " + hostname + " " + port, e); } JSONArray diskJSONArray = jsonObject.getJSONArray("disks"); this.disks = new ArrayList<Disk>(diskJSONArray.length()); for (int i = 0; i < diskJSONArray.length(); ++i) { this.disks.add(new Disk(this, diskJSONArray.getJSONObject(i), clusterMapConfig)); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); this.ports = new HashMap<PortType, Integer>(); this.ports.put(PortType.PLAINTEXT, port); populatePorts(jsonObject); <START> this.rackId = jsonObject.has("rackId")? jsonObject.getInt("rackId") : null; <END> validate(); }</code><technical_language>getInt() do if integer</technical_language>

Target:
public DataNode(Datacenter datacenter, JSONObject jsonObject, ClusterMapConfig clusterMapConfig) throws JSONException { if (logger.isTraceEnabled()) { logger.trace("DataNode " + jsonObject.toString()); } this.datacenter = datacenter; this.hostname = getFullyQualifiedDomainName(jsonObject.getString("hostname")); this.port = jsonObject.getInt("port"); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils .getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.valueOf(jsonObject.getString("hardwareState")), clusterMapConfig); this.dataNodeStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a datanode " + e); throw new IllegalStateException( "Error creating resource state policy when instantiating a datanode: " + hostname + " " + port, e); } JSONArray diskJSONArray = jsonObject.getJSONArray("disks"); this.disks = new ArrayList<Disk>(diskJSONArray.length()); for (int i = 0; i < diskJSONArray.length(); ++i) { this.disks.add(new Disk(this, diskJSONArray.getJSONObject(i), clusterMapConfig)); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); this.ports = new HashMap<PortType, Integer>(); this.ports.put(PortType.PLAINTEXT, port); populatePorts(jsonObject); if (jsonObject.has("rackId")) { this.rackId = jsonObject.getLong("rackId"); if (this.rackId < 0) { throw new IllegalStateException("Invalid rackId : " + this.rackId + " is less than 0"); } } else { this.rackId = MissingRackId; } validate(); }
Source:
<code>public int get(PageId pageId, int pageOffset, byte[] buffer, int bufferOffset) throws IOException, PageNotFoundException { Preconditions.checkArgument(pageOffset >= 0, "page offset should be non-negative"); Preconditions.checkArgument(buffer.length >= bufferOffset, "page offset %s should be " + "less or equal than buffer length %s", bufferOffset, buffer.length); Path p = getFilePath(pageId); if (!Files.exists(p)) { throw new PageNotFoundException(p.toString()); } long fileLen = p.toFile().length(); Preconditions.checkArgument(pageOffset <= fileLen, "page offset %s exceeded page size %s", pageOffset, fileLen); try (RandomAccessFile localFile = new RandomAccessFile(p.toString(), "r")) { localFile.skipBytes(pageOffset); return localFile.read(buffer, bufferOffset, (int) Math.min(fileLen - pageOffset, <START> buffer.length - bufferOffset)); <END> } }</code><technical_language>Do need do this read in a loop guaranteed read full data in call</technical_language>

Target:
public int get(PageId pageId, int pageOffset, byte[] buffer, int bufferOffset) throws IOException, PageNotFoundException { Preconditions.checkArgument(pageOffset >= 0, "page offset should be non-negative"); Preconditions.checkArgument(buffer.length >= bufferOffset, "page offset %s should be " + "less or equal than buffer length %s", bufferOffset, buffer.length); Path p = getFilePath(pageId); if (!Files.exists(p)) { throw new PageNotFoundException(p.toString()); } long pageLength = p.toFile().length(); Preconditions.checkArgument(pageOffset <= pageLength, "page offset %s exceeded page size %s", pageOffset, pageLength); try (RandomAccessFile localFile = new RandomAccessFile(p.toString(), "r")) { int bytesSkipped = localFile.skipBytes(pageOffset); if (pageOffset != bytesSkipped) { throw new IOException( String.format("Failed to read page %s (%s) from offset %s: %s bytes skipped", pageId, p, pageOffset, bytesSkipped)); } int bytesRead = 0; int bytesLeft = (int) Math.min(pageLength - pageOffset, buffer.length - bufferOffset); while (bytesLeft >= 0) { int bytes = localFile.read(buffer, bufferOffset + bytesRead, bytesLeft); if (bytes < 0) { break; } bytesRead += bytes; bytesLeft -= bytes; } return bytesRead; } }
Source:
<code>public PathData <START> getPathData() { <END> if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); int count = Gdip.GraphicsPath_GetPointCount(handle); byte[] gdipTypes = new byte[count]; float[] points = new float[count * 2]; Gdip.GraphicsPath_GetPathTypes(handle, gdipTypes, count); Gdip.GraphicsPath_GetPathPoints(handle, points, count); byte[] types = new byte[count * 2]; int index = 0, typesIndex = 0; while (index < count) { byte type = gdipTypes[index]; boolean close = false; switch (type & Gdip.PathPointTypePathTypeMask) { case Gdip.PathPointTypeStart: types[typesIndex++] = SWT.PATH_MOVE_TO; close = (type & Gdip.PathPointTypeCloseSubpath) != 0; index += 1; break; case Gdip.PathPointTypeLine: types[typesIndex++] = SWT.PATH_LINE_TO; close = (type & Gdip.PathPointTypeCloseSubpath) != 0; index += 1; break; case Gdip.PathPointTypeBezier: types[typesIndex++] = SWT.PATH_CUBIC_TO; close = (gdipTypes[index + 2] & Gdip.PathPointTypeCloseSubpath) != 0; index += 3; break; default: index++; } if (close) { types[typesIndex++] = SWT.PATH_CLOSE; } } if (typesIndex != types.length) { byte[] newTypes = new byte[typesIndex]; System.arraycopy(types, 0, newTypes, 0, typesIndex); types = newTypes; } PathData result = new PathData(); result.types = types; result.points = DPIUtil.autoScaleDown(points); return result; }</code><technical_language>Suggest follow *InPixel method approach too: - Rename current method getPathDataInPixels() - Create a new method getPathData() perform AutoScaleDown operation</technical_language>

Target:
public PathData getPathData() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); PathData result = getPathDataInPixels(); result.points = DPIUtil.autoScaleDown(result.points); return result; }
Source:
<code>public WidgetPageObject createMultiple() { <START> String[] tags = getTags(); <END> String articleContentString = ""; ArticleContent articleContent = new ArticleContent(); articleContent.clear(getArticleName()); for (String tag: tags) { articleContentString += tag + "\n"; } articleContent.push(articleContentString, getArticleName()); return this; }</code><technical_language>tags ones, please access in for</technical_language>

Target:
public WidgetPageObject createMultiple() { String text = ""; ArticleContent articleContent = new ArticleContent(); articleContent.clear(getArticleName()); for (String tag : getTags()) { text += tag + "\n"; } articleContent.push(text, getArticleName()); return this; }
Source:
<code>public ResponseEntity setModelVersion(String version) { <START> boolean validRequest = version != null && !StringUtils.isEmpty(version); <END> if (validRequest) { try { if (sourceCodeManager.getAvailableVersions().contains(version)) { configurationService.setModelRepositoryVersion(version); } else { return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.NO_CONTENT); } catch (Exception e) { return new ResponseEntity(HttpStatus.BAD_REQUEST); } } return new ResponseEntity(HttpStatus.BAD_REQUEST); }</code><technical_language>remove "version != null &&", StringUtils.isEmpty handles nulls</technical_language>

Target:
public ResponseEntity setModelVersion(String version) { boolean validRequest = !StringUtils.isEmpty(version); if (validRequest) { try { if (sourceCodeManager.getAvailableVersions().contains(version)) { configurationService.setModelRepositoryVersion(version); } else { return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.NO_CONTENT); } catch (Exception e) { return new ResponseEntity(HttpStatus.BAD_REQUEST); } } return new ResponseEntity(HttpStatus.BAD_REQUEST); }
Source:
<code>public static JobExecutorServiceHandler getHandler(final String type) { if (Strings.isNullOrEmpty(type)) { <START> return ElasticJobServiceLoader.getCachedTypedServiceInstance(JobExecutorServiceHandler.class, DEFAULT_HANDLER) <END> .orElseThrow(() -> new JobConfigurationException("The parameter named 'type' is null or empty," + " and cannot find default executor service handler using default type '%s'.", DEFAULT_HANDLER)); } return ElasticJobServiceLoader.getCachedTypedServiceInstance(JobExecutorServiceHandler.class, type) .orElseThrow(() -> new JobConfigurationException("Cannot find executor service handler using type '%s'.", type)); }</code><technical_language>Is necessary check if default handler present? this happen</technical_language>

Target:
public static JobExecutorServiceHandler getHandler(final String type) { if (Strings.isNullOrEmpty(type)) { return ElasticJobServiceLoader.getCachedTypedServiceInstance(JobExecutorServiceHandler.class, DEFAULT_HANDLER).get(); } return ElasticJobServiceLoader.getCachedTypedServiceInstance(JobExecutorServiceHandler.class, type) .orElseThrow(() -> new JobConfigurationException("Cannot find executor service handler using type '%s'.", type)); }
Source:
<code>private List<Map<String, String>> possibleTablePartitions(String table) { TableId tableId = dialect.parseTableIdentifier(table); String fqn = ExpressionBuilder.create().append(tableId, false).toString(); Map<String, String> partitionWithFqn = new HashMap<>(); partitionWithFqn.put(JdbcSourceConnectorConstants.TABLE_NAME_KEY, fqn); partitionWithFqn.put( JdbcSourceConnectorConstants.OFFSET_PROTOCOL_VERSION_KEY, JdbcSourceConnectorConstants.PROTOCOL_VERSION_ONE ); Map<String, String> partition = Collections.singletonMap( JdbcSourceConnectorConstants.TABLE_NAME_KEY, tableId.tableName() <START> ); <END> return Arrays.asList(partitionWithFqn, partition); }</code><technical_language>This call: Map<String, String> partition = OffsetProtocols.sourcePartitionForProtocolV0(tableId);</technical_language>

Target:
private List<Map<String, String>> possibleTablePartitions(String table) { TableId tableId = dialect.parseTableIdentifier(table); return Arrays.asList( OffsetProtocols.sourcePartitionForProtocolV1(tableId), OffsetProtocols.sourcePartitionForProtocolV0(tableId) ); }
Source:
<code>public ServiceAccountCredential(CredentialsScope scope, String id, String description) { <START> super(scope, id, description, null); <END> }</code><technical_language>NIT: approach of passing null token is a right here, impact <code> BearerTokenCredential</code>, start raw token field in other methods</technical_language>

Target:
public ServiceAccountCredential(CredentialsScope scope, String id, String description) { super(scope, id, description); }
Source:
<code>public void testDeleteCardUsingFilter() throws Throwable { this.testYearFilter(); int cardIndex = 0; final int year = 1993; Predicate<BaseballCard> yearPred = new Predicate<BaseballCard>() { @Override public boolean doTest(BaseballCard card) { return card.getYear() == year; } }; this.expectedCards = BBCTTestUtil.filterList(this.allCards, yearPred); this.expectedCards.remove(cardIndex); Assert.assertTrue(this.solo.waitForView(R.id.select_all)); this.solo.clickOnCheckBox(cardIndex + 1); Assert.assertTrue(this.solo.waitForView(R.id.delete_menu)); <START> <END> View deleteMenu = this.activity.findViewById(R.id.delete_menu); Assert.assertNotNull(deleteMenu); TouchUtils.clickView(this, deleteMenu); BBCTTestUtil.waitForToast(this.solo, BBCTTestUtil.DELETE_MESSAGE); ListView lv = (ListView) this.solo.getCurrentActivity().findViewById(android.R.id.list); BBCTTestUtil.assertListViewContainsItems(this.expectedCards, lv); }</code><technical_language>ok move lines BBCTTestUtil.removeCard</technical_language>

Target:
public void testDeleteCardUsingFilter() throws Throwable { this.testYearFilter(); int cardIndex = 0; final int year = 1993; Predicate<BaseballCard> yearPred = new Predicate<BaseballCard>() { @Override public boolean doTest(BaseballCard card) { return card.getYear() == year; } }; this.expectedCards = BBCTTestUtil.filterList(this.allCards, yearPred); this.expectedCards.remove(cardIndex); Assert.assertTrue(this.solo.waitForView(R.id.select_all)); this.solo.clickOnCheckBox(cardIndex + 1); Assert.assertTrue(this.solo.waitForView(R.id.delete_menu)); deleteCards(); ListView lv = (ListView) this.solo.getCurrentActivity().findViewById(android.R.id.list); BBCTTestUtil.assertListViewContainsItems(this.expectedCards, lv); }
Source:
<code>private static boolean checkEither(Multimap<Column, Filter> filters, EntityRecordWithColumns record) { for (Map.Entry<Column, Filter> filter : filters.entries()) { Column column = filter.getKey(); if (!record.hasColumn(column.name())) { <START> continue; <END> } @Nullable Object columnValue = columnValue(record, column); boolean matches = checkSingleParameter(filter.getValue(), columnValue, column); if (matches) { return true; } } return filters.isEmpty(); }</code><technical_language>Please try get rid of continue. stream API instead</technical_language>

Target:
private static boolean checkEither(Multimap<Column, Filter> filters, EntityRecordWithColumns record) { if (filters.isEmpty()) { return true; } boolean result = filters.entries() .stream() .anyMatch(filter -> matches(record, filter)); return result; }
Source:
<code>private boolean hasAnnotation(final MethodNode methodNode) { <START> final List<AnnotationNode> runtimeInvisibleAnnotations = methodNode.invisibleAnnotations; <END> if (runtimeInvisibleAnnotations != null) { for (final AnnotationNode annotation : runtimeInvisibleAnnotations) { if (descType.equals(annotation.desc)) { return true; } } } return false; }</code><technical_language>In contrast Lombok, Groovy adds visible annotation, while check invisibleAnnotations, currently filter work</technical_language>

Target:
private boolean hasAnnotation(final MethodNode methodNode) { final List<AnnotationNode> annotations = getAnnotations(methodNode); if (annotations != null) { for (final AnnotationNode annotation : annotations) { if (descType.equals(annotation.desc)) { return true; } } } return false; }
Source:
<code>public void onMachineSelected(final MachineEntity selectedMachine) { this.selectedMachine = selectedMachine; if (cachedMachines.containsKey(selectedMachine.getId())) { appliance.showAppliance(cachedMachines.get(selectedMachine.getId())); return; } if (RUNNING == selectedMachine.getStatus()) { isMachineRunning = true; cachedMachines.put(selectedMachine.getId(), selectedMachine); appliance.showAppliance(selectedMachine); } else { isMachineRunning = false; if (!selectedMachine.getConfig().isDev()) { <START> appliance.showStub(locale.unavailableMachineStarting(selectedMachine.getConfig().getName())); <END> } } }</code><technical_language>complex construct</technical_language>

Target:
public void onMachineSelected(final MachineEntity selectedMachine) { this.selectedMachine = selectedMachine; if (cachedMachines.containsKey(selectedMachine.getId())) { appliance.showAppliance(cachedMachines.get(selectedMachine.getId())); return; } if (RUNNING == selectedMachine.getStatus()) { isMachineRunning = true; cachedMachines.put(selectedMachine.getId(), selectedMachine); appliance.showAppliance(selectedMachine); } else { isMachineRunning = false; final MachineConfig machineConfig = selectedMachine.getConfig(); final boolean isDevMachine = machineConfig.isDev(); final String machineName = machineConfig.getName(); if (!isDevMachine) { appliance.showStub(locale.unavailableMachineStarting(machineName)); } } }
Source:
<code>public boolean isSaveButtonEnabled() { if (Existence.existsImmediately(driver, getSaveButtonDisabled())) { return false; } else if (Existence.existsImmediately(driver, getSaveButton())) { return true; } else { <START> throw new NoSuchElementException("Save button wasn't found."); <END> } }</code><technical_language>If element exist, condition return false. is _third_ option, usual if-else suffice</technical_language>

Target:
public boolean isSaveButtonEnabled() { info("Checking that the save button exists."); if (Existence.existsImmediately(driver, getSaveButtonDisabled())) { info("The save button disabled."); return false; } else if (Existence.existsImmediately(driver, getSaveButton())) { info("The save button exists and enabled."); return true; } else { throw new NoSuchElementException("Save button wasn't found."); } }
Source:
<code>private List<String> getV2CapabilityAdvertisement() { ArrayList<String> caps = new ArrayList<>(); caps.add("version 2"); caps.add(COMMAND_LS_REFS); boolean advertiseRefInWant = transferConfig.isAllowRefInWant() && db.getConfig().getBoolean("uploadpack", null, "advertiserefinwant", true); <START> boolean advertiseSidebandAll = transferConfig.isAdvertiseSidebandAll() <END> && db.getConfig().getBoolean("uploadpack", null, "advertisesidebandall", false); caps.add(COMMAND_FETCH + '=' + (transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + (advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "") + (advertiseSidebandAll ? OPTION_SIDEBAND_ALL + ' ' : "") + (cachedPackUriProvider != null ? "packfile-uris " : "") + OPTION_SHALLOW); caps.add(CAPABILITY_SERVER_OPTION); return caps; }</code><technical_language>I understand this bit. do need more complex transferConfig.isAdvertiseSidebandAll() here</technical_language>

Target:
private List<String> getV2CapabilityAdvertisement() { ArrayList<String> caps = new ArrayList<>(); caps.add("version 2"); caps.add(COMMAND_LS_REFS); boolean advertiseRefInWant = transferConfig.isAllowRefInWant() && db.getConfig().getBoolean("uploadpack", null, "advertiserefinwant", true); caps.add(COMMAND_FETCH + '=' + (transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "") + (advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "") + (transferConfig.isAdvertiseSidebandAll() ? OPTION_SIDEBAND_ALL + ' ' : "") + (cachedPackUriProvider != null ? "packfile-uris " : "") + OPTION_SHALLOW); caps.add(CAPABILITY_SERVER_OPTION); return caps; }
Source:
<code>private static void setupReq() throws Exception{ MetaClass meta = Mockito.mock(MetaClass.class); SingleLinkedList<MethodRef> list = SingleLinkedList.empty(); given(meta.getPostConstructMethods()).willReturn(list); WebApp webApp = Mockito.mock(WebApp.class); setFinal(webApp, WebApp.class.getDeclaredField("bindInterceptors"), new ArrayList<BindInterceptor>(0)); given(webApp.getMetaClass(Mockito.any(GhprbTrigger.class))).willReturn(meta); req = Mockito.mock(RequestImpl.class); given(req.bindJSON(any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.bindJSON(any(Class.class), any(Class.class), any(JSONObject.class))).willCallRealMethod(); <START> given(req.setBindInterceptpr(any(BindInterceptor.class))).willCallRealMethod(); <END> given(req.setBindListener(any(BindInterceptor.class))).willCallRealMethod(); given(req.getBindInterceptor()).willReturn(BindInterceptor.NOOP); given(req.getWebApp()).willReturn(webApp); req.setBindListener(BindInterceptor.NOOP); req.setBindInterceptpr(BindInterceptor.NOOP); req.setBindInterceptor(BindInterceptor.NOOP); }</code><technical_language>setBindIntercept_**o**_r I spent hours battling this NPE, I knew a mocking problem it. PR typo in setBindinterceptpr is blindingly obvious. I checked out PR locally, fixed typo tests pass :shipit:</technical_language>

Target:
private static void setupReq() throws Exception{ MetaClass meta = Mockito.mock(MetaClass.class); SingleLinkedList<MethodRef> list = SingleLinkedList.empty(); given(meta.getPostConstructMethods()).willReturn(list); WebApp webApp = Mockito.mock(WebApp.class); setFinal(webApp, WebApp.class.getDeclaredField("bindInterceptors"), new ArrayList<BindInterceptor>(0)); given(webApp.getMetaClass(Mockito.any(GhprbTrigger.class))).willReturn(meta); req = Mockito.mock(RequestImpl.class); given(req.bindJSON(any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.bindJSON(any(Class.class), any(Class.class), any(JSONObject.class))).willCallRealMethod(); given(req.setBindInterceptor(any(BindInterceptor.class))).willCallRealMethod(); given(req.setBindListener(any(BindInterceptor.class))).willCallRealMethod(); given(req.getWebApp()).willReturn(webApp); req.setBindListener(BindInterceptor.NOOP); req.setBindInterceptpr(BindInterceptor.NOOP); req.setBindInterceptor(BindInterceptor.NOOP); }
Source:
<code>private ContentLayer( final Builder builder ) { <START> Preconditions.checkNotNull( builder.key, "Name cannot be null" ); <END> Preconditions.checkNotNull( builder.displayName, "Display name cannot be null" ); key = builder.key; parentKeys = builder.parentKeys.build(); displayName = builder.displayName; description = builder.description; locale = builder.locale; icon = builder.icon; }</code><technical_language>a message for name instead of key</technical_language>

Target:
private ContentLayer( final Builder builder ) { Preconditions.checkNotNull( builder.key, "Key cannot be null" ); Preconditions.checkNotNull( builder.displayName, "Display name cannot be null" ); key = builder.key; parentKeys = builder.parentKeys.build(); displayName = builder.displayName; description = builder.description; locale = builder.locale; icon = builder.icon; }
Source:
<code>private Properties getAssetProperties(Asset asset) { Properties assetProperties = new Properties(); <START> assetProperties.put(CuCamsConstants.CapAssetApi.CAPITAL_ASSET_NUMBER, asset.getCapitalAssetNumber()); <END> safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAMPUS_TAG_NUMBER_ATTRIBUTE, asset.getCampusTagNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.BUILDING_CODE, asset.getBuildingCode()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ROOM_NUMBER, asset.getBuildingRoomNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ORGANIZATION_INVENTORY_NAME, asset.getOrganizationInventoryName()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.SERIAL_NUMBER, asset.getSerialNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAPITAL_ASSET_DESCRIPTION, asset.getCapitalAssetDescription()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_UPDATED, asset.getLastUpdatedTimestamp().toString()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_INVENTORY_DATE, asset.getLastInventoryDate().toString()); return assetProperties; }</code><technical_language>this line "safelyAddProperty" method, in other lines it</technical_language>

Target:
private Properties getAssetProperties(Asset asset) { Properties assetProperties = new Properties(); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAPITAL_ASSET_NUMBER, asset.getCapitalAssetNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAMPUS_TAG_NUMBER_ATTRIBUTE, asset.getCampusTagNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.BUILDING_CODE, asset.getBuildingCode()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ROOM_NUMBER, asset.getBuildingRoomNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.ORGANIZATION_INVENTORY_NAME, asset.getOrganizationInventoryName()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.SERIAL_NUMBER, asset.getSerialNumber()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.CAPITAL_ASSET_DESCRIPTION, asset.getCapitalAssetDescription()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_UPDATED, asset.getLastUpdatedTimestamp().toString()); safelyAddProperty(assetProperties, CuCamsConstants.CapAssetApi.LAST_INVENTORY_DATE, asset.getLastInventoryDate().toString()); return assetProperties; }
Source:
<code>public static File extract(File toExtract) throws Exception { String dir = getMd5hash(toExtract); if (dir == null) { dir = UUID.randomUUID().toString(); } File targetDir = new File(DRONE_TARGET_DIRECTORY + File.separator + dir); synchronized (log) { if (!targetDir.exists() || targetDir.listFiles().length == 0) { targetDir.mkdirs(); String filePath = toExtract.getAbsolutePath(); log.info("Extracting zip file: " + toExtract + " to " + targetDir.getPath()); if (filePath.endsWith(".zip")) { Spacelift.task(toExtract, UnzipTool.class).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.gz")) { Spacelift.task(toExtract, UntarTool.class).gzip(true).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.bz2")) { Spacelift.task(toExtract, UntarTool.class).bzip2(true).toDir(targetDir).execute().await(); } else { log.info( <START> "The file " + toExtract + " is not compressed by format by a format that is supported by Drone. " <END> + "Drone supported formats are .zip, .tar.gz, .tar.bz2. The file will be only copied"); targetDir.mkdirs(); Files.copy(toExtract.toPath(), new File(targetDir + File.separator + toExtract.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } } } return targetDir; }</code><technical_language>format a format I bye bye part of this ;)</technical_language>

Target:
public static File extract(File toExtract) throws Exception { String dir = getMd5hash(toExtract); if (dir == null) { dir = UUID.randomUUID().toString(); } File targetDir = new File(DRONE_TARGET_DIRECTORY + File.separator + dir); synchronized (log) { if (!targetDir.exists() || targetDir.listFiles().length == 0) { targetDir.mkdirs(); String filePath = toExtract.getAbsolutePath(); log.info("Extracting zip file: " + toExtract + " to " + targetDir.getPath()); if (filePath.endsWith(".zip")) { Spacelift.task(toExtract, UnzipTool.class).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.gz")) { Spacelift.task(toExtract, UntarTool.class).gzip(true).toDir(targetDir).execute().await(); } else if (filePath.endsWith(".tar.bz2")) { Spacelift.task(toExtract, UntarTool.class).bzip2(true).toDir(targetDir).execute().await(); } else { log.info( "The file " + toExtract + " is not compressed by a format that is supported by Drone. " + "Drone supported formats are .zip, .tar.gz, .tar.bz2. The file will be only copied"); targetDir.mkdirs(); Files.copy(toExtract.toPath(), new File(targetDir + File.separator + toExtract.getName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } } } return targetDir; }
Source:
<code>public AsyncSplitSource(CloseableIterator<T> iterator, Function<T, ? extends ConnectorSplit> toSplit, Executor executor) { this.iterator = new SynchronizedCloseableIterator<>(iterator); this.toSplit = requireNonNull(toSplit, "toSplit is null"); <START> this.executor = requireNonNull(executor, "execute is null"); <END> }</code><technical_language>executor is null</technical_language>

Target:
public AsyncSplitSource(CloseableIterator<T> iterator, Function<T, ? extends ConnectorSplit> toSplit, Executor executor) { this.iterator = new SynchronizedCloseableIterator<>(iterator); this.toSplit = requireNonNull(toSplit, "toSplit is null"); this.executor = requireNonNull(executor, "executor is null"); }
Source:
<code>public void processAst(IASTTranslationUnit ast) { ast.accept(new ASTVisitor() { { shouldVisitDeclarations = true; } @Override public int visit(IASTDeclaration declaration) { if (declaration instanceof IASTSimpleDeclaration) { IASTSimpleDeclaration simple = (IASTSimpleDeclaration) declaration; IASTDeclarator decls[] = ((IASTSimpleDeclaration) declaration).getDeclarators(); if (simple.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_static && declaration.getTranslationUnit().isHeaderUnit()) { <START> if (decls.length > 0) { <END> for (IASTDeclarator d : decls) { IBinding binding = d.getName().resolveBinding(); if (binding != null && binding instanceof IVariable) { try { IScope scope = binding.getScope(); if (scope == null) return PROCESS_CONTINUE; if (scope.getKind() == EScopeKind.eGlobal || scope.getKind() == EScopeKind.eNamespace) reportProblem(STATIC_VAR_ID, declaration, d.getName()); } catch (DOMException e) { CodanCheckersActivator.log(e); } } } } } if (decls.length == 0) return PROCESS_CONTINUE; if (decls.length != 1) reportProblem(VAR_MULTI_DEC_ID, declaration); } return PROCESS_CONTINUE; } }); }</code><technical_language>is point this check: if decls.length is zero, loop iterate zero times</technical_language>

Target:
public void processAst(IASTTranslationUnit ast) { ast.accept(new ASTVisitor() { { shouldVisitDeclarations = true; } @Override public int visit(IASTDeclaration declaration) { if (declaration instanceof IASTSimpleDeclaration) { IASTSimpleDeclaration simple = (IASTSimpleDeclaration) declaration; IASTDeclarator decls[] = ((IASTSimpleDeclaration) declaration).getDeclarators(); if (simple.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_static && declaration.getTranslationUnit().isHeaderUnit()) { for (IASTDeclarator d : decls) { IBinding binding = d.getName().resolveBinding(); if (binding != null && binding instanceof IVariable) { try { IScope scope = binding.getScope(); if (scope == null) return PROCESS_CONTINUE; if (scope.getKind() == EScopeKind.eGlobal || scope.getKind() == EScopeKind.eNamespace) reportProblem(STATIC_VAR_ID, declaration, d.getName()); } catch (DOMException e) { CodanCheckersActivator.log(e); } } } } if (declaration.getParent() instanceof IASTDeclarationStatement) { IASTDeclarationStatement declStatement = (IASTDeclarationStatement) declaration.getParent(); IASTNode node = declStatement.getParent(); if (node instanceof IASTForStatement || node instanceof IASTIfStatement || node instanceof IASTSwitchStatement) { return PROCESS_CONTINUE; } } if (decls.length == 0) return PROCESS_CONTINUE; if (decls.length != 1) reportProblem(VAR_MULTI_DEC_ID, declaration); } return PROCESS_CONTINUE; } }); }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); Passphrase transferCode = getArguments().getParcelable(EXTRA_TRANSFER_CODE); ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity); CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme); @SuppressLint("InflateParams") View view = LayoutInflater.from(theme).inflate(R.layout.api_display_transfer_code, null, false); alert.setView(view); <START> alert.setPositiveButton("Got it", (dialog, which) -> dismiss()); <END> TextView[] transferCodeTextViews = new TextView[9]; transferCodeTextViews[0] = view.findViewById(R.id.transfer_code_block_1); transferCodeTextViews[1] = view.findViewById(R.id.transfer_code_block_2); transferCodeTextViews[2] = view.findViewById(R.id.transfer_code_block_3); transferCodeTextViews[3] = view.findViewById(R.id.transfer_code_block_4); transferCodeTextViews[4] = view.findViewById(R.id.transfer_code_block_5); transferCodeTextViews[5] = view.findViewById(R.id.transfer_code_block_6); transferCodeTextViews[6] = view.findViewById(R.id.transfer_code_block_7); transferCodeTextViews[7] = view.findViewById(R.id.transfer_code_block_8); transferCodeTextViews[8] = view.findViewById(R.id.transfer_code_block_9); setTransferCode(transferCodeTextViews, transferCode); return alert.create(); }</code><technical_language>nitpick: translatable</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); Passphrase transferCode = getArguments().getParcelable(EXTRA_TRANSFER_CODE); ContextThemeWrapper theme = ThemeChanger.getDialogThemeWrapper(activity); CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(theme); @SuppressLint("InflateParams") View view = LayoutInflater.from(theme).inflate(R.layout.api_display_transfer_code, null, false); alert.setView(view); alert.setPositiveButton(R.string.button_got_it, (dialog, which) -> dismiss()); TextView[] transferCodeTextViews = new TextView[9]; transferCodeTextViews[0] = view.findViewById(R.id.transfer_code_block_1); transferCodeTextViews[1] = view.findViewById(R.id.transfer_code_block_2); transferCodeTextViews[2] = view.findViewById(R.id.transfer_code_block_3); transferCodeTextViews[3] = view.findViewById(R.id.transfer_code_block_4); transferCodeTextViews[4] = view.findViewById(R.id.transfer_code_block_5); transferCodeTextViews[5] = view.findViewById(R.id.transfer_code_block_6); transferCodeTextViews[6] = view.findViewById(R.id.transfer_code_block_7); transferCodeTextViews[7] = view.findViewById(R.id.transfer_code_block_8); transferCodeTextViews[8] = view.findViewById(R.id.transfer_code_block_9); setTransferCode(transferCodeTextViews, transferCode); return alert.create(); }
Source:
<code>private Map<String, String> retrieveByLocale(Locale locale, String messageSource, Map<String, String> messages) { try { ResourceBundle bundle = ResourceBundle.getBundle(messageSource, locale); for (String key : bundle.keySet()) { if (!messages.containsKey(key)) { messages.put(key, bundle.getString(key)); } else { log.warn("Code '{}' appears more than once in string table.", key); } } } catch (RuntimeException e) { <START> log.error("File: '{}' could not be loaded: {}", messageSource, e.toString()); <END> log.debug("Exception", e); } return messages; }</code><technical_language>e.getMessage()</technical_language>

Target:
private Map<String, String> retrieveByLocale(Locale locale, String messageSource, Map<String, String> messages) { try { ResourceBundle bundle = ResourceBundle.getBundle(messageSource, locale); for (String key : bundle.keySet()) { if (!messages.containsKey(key)) { messages.put(key, bundle.getString(key)); } else { log.warn("Code '{}' appears more than once in string table.", key); } } } catch (RuntimeException e) { log.error("File: '{}' could not be loaded: {}", messageSource, e.getMessage()); log.debug("Exception", e); } return messages; }
Source:
<code>static boolean isJdtCoreSettingsResource(IResource resource) { IPath resourcePath = resource.getProjectRelativePath(); String prefs = JavaProject.DEFAULT_PREFERENCES_DIRNAME + <START> File.separator + <END> JavaProject.JAVA_CORE_PREFS_FILE; IPath expectedPath = Path.fromPortableString(prefs); boolean isJdtCoreSettingsResource = expectedPath.equals(resourcePath); return isJdtCoreSettingsResource; }</code><technical_language>This break Windows. portableString "/" platforms. Please org.eclipse.core.runtime.IPath.SEPARATOR</technical_language>

Target:
static boolean isJdtCoreSettingsResource(IResource resource) { IPath resourcePath = resource.getProjectRelativePath(); String prefs = JavaProject.DEFAULT_PREFERENCES_DIRNAME + IPath.SEPARATOR + JavaProject.JAVA_CORE_PREFS_FILE; IPath expectedPath = Path.fromPortableString(prefs); boolean isJdtCoreSettingsResource = expectedPath.equals(resourcePath); return isJdtCoreSettingsResource; }
Source:
<code>private Tags(Map<String, String> tags, boolean isObject) throws IllegalArgumentException { <START> if (tags == null) { return; } <END> if (isObject) { if (tags.size() > MAX_OBJECT_TAG_COUNT) { throw new IllegalArgumentException( "too many object tags; allowed = " + MAX_OBJECT_TAG_COUNT + ", found = " + tags.size()); } } else if (tags.size() > MAX_TAG_COUNT) { throw new IllegalArgumentException( "too many bucket tags; allowed = " + MAX_TAG_COUNT + ", found = " + tags.size()); } for (Map.Entry<String, String> entry : tags.entrySet()) { String key = entry.getKey(); if (key.length() == 0 || key.length() > MAX_KEY_LENGTH || key.contains("&")) { throw new IllegalArgumentException("invalid tag key '" + key + "'"); } String value = entry.getValue(); if (value.length() > MAX_VALUE_LENGTH || value.contains("&")) { throw new IllegalArgumentException("invalid tag value '" + value + "'"); } } this.tags = Collections.unmodifiableMap(tags); }</code><technical_language>this condition throw exception</technical_language>

Target:
private Tags(Map<String, String> tags, boolean isObject) throws IllegalArgumentException { if (tags == null) { return; } int limit = isObject ? MAX_OBJECT_TAG_COUNT : MAX_TAG_COUNT; if (tags.size() > limit) { throw new IllegalArgumentException( "too many " + (isObject ? "object" : "bucket") + " tags; allowed = " + limit + ", found = " + tags.size()); } for (Map.Entry<String, String> entry : tags.entrySet()) { String key = entry.getKey(); if (key.length() == 0 || key.length() > MAX_KEY_LENGTH || key.contains("&")) { throw new IllegalArgumentException("invalid tag key '" + key + "'"); } String value = entry.getValue(); if (value.length() > MAX_VALUE_LENGTH || value.contains("&")) { throw new IllegalArgumentException("invalid tag value '" + value + "'"); } } this.tags = Collections.unmodifiableMap(tags); }
Source:
<code>public void testFieldFQNTypeIsMaintainedIfAnotherImportExists() { final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); javaClass.setPackage("testPackage").setName("Main"); javaClass.addField().setName("field1").setType("package1.Type"); javaClass.addField().setName("field2").setType("package2.Type"); assertThat(javaClass.getField("field2").getType().getQualifiedName()) <START> .isEqualTo("pa\ckage2.Type"); <END> }</code><technical_language>Is backslash purpose</technical_language>

Target:
public void testFieldFQNTypeIsMaintainedIfAnotherImportExists() { final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); javaClass.setPackage("testPackage").setName("Main"); javaClass.addField().setName("field1").setType("package1.Type"); javaClass.addField().setName("field2").setType("package2.Type"); assertThat(javaClass.getField("field2").getType().getQualifiedName()) .isEqualTo("package2.Type"); }
Source:
<code>public static void createOverrideAnnotation(ASTRewrite rewrite, ImportRewrite imports, MethodDeclaration decl, TextEditGroup group) { <START> if (isOverrideAnnotationPresent(decl)) <END> return; Annotation marker= rewrite.getAST().newMarkerAnnotation(); ImportRewriteContext context; ASTNode root= decl.getRoot(); if (root instanceof CompilationUnit) { context= new ContextSensitiveImportRewriteContext((CompilationUnit) root, decl.getStartPosition(), imports); } else { context= null; } marker.setTypeName(rewrite.getAST().newName(imports.addImport("java.lang.Override", context))); rewrite.getListRewrite(decl, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(marker, group); }</code><technical_language>Change 'if' block in new code</technical_language>

Target:
public static void createOverrideAnnotation(ASTRewrite rewrite, ImportRewrite imports, MethodDeclaration decl, TextEditGroup group) { if (findAnnotation("java.lang.Override", decl.modifiers()) != null) { return; } AST ast= rewrite.getAST(); Annotation marker= ast.newMarkerAnnotation(); ImportRewriteContext context= null; ASTNode root= decl.getRoot(); if (root instanceof CompilationUnit) { context= new ContextSensitiveImportRewriteContext((CompilationUnit) root, decl.getStartPosition(), imports); } marker.setTypeName(ast.newName(imports.addImport("java.lang.Override", context))); rewrite.getListRewrite(decl, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(marker, group); }
Source:
<code>public void setNodeTokens(String nodeUrl, List<String> tokens) throws RMException { <START> if (tokens.stream().filter(token -> token == null || token.isEmpty()).findFirst().isPresent()) { <END> throw new RMException("Invalid empty token in list " + tokens); } if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); rmNode.setNodeTokens(nodeUrl, tokens); persistUpdatedRMNodeIfRecoveryEnabled(rmNode); registerAndEmitNodeEvent(rmNode.createNodeEvent(RMEventType.NODE_STATE_CHANGED, rmNode.getState(), rmNode.getProvider().getName())); } else { throw new RMException("Unknown node " + nodeUrl); } }</code><technical_language>tokens.stream().anyMatch() here</technical_language>

Target:
public void setNodeTokens(String nodeUrl, List<String> tokens) throws RMException { if (tokens.stream().anyMatch(token -> token == null || token.isEmpty())) { throw new RMException("Invalid empty token in list " + tokens); } if (allNodes.containsKey(nodeUrl)) { RMNode rmNode = allNodes.get(nodeUrl); rmNode.setNodeTokens(nodeUrl, tokens); persistUpdatedRMNodeIfRecoveryEnabled(rmNode); registerAndEmitNodeEvent(rmNode.createNodeEvent(RMEventType.NODE_STATE_CHANGED, rmNode.getState(), rmNode.getProvider().getName())); } else { throw new RMException("Unknown node " + nodeUrl); } }
Source:
<code>public void update() { if(isClientWorld()) { return; } if(!isActive()) { if(tick == 0) { checkMultiblockStructure(); } } else { if(tick % 4 == 0) { heatItems(); <START> interactWithEntitiesInside(); <END> } if(needsFuel) { consumeFuel(); } } tick = (tick + 1) % 20; }</code><technical_language>smeltery runs this 20 ticks, tick == 0</technical_language>

Target:
public void update() { if(isClientWorld()) { return; } if(!isActive()) { if(tick == 0) { checkMultiblockStructure(); } } else { if(tick % 4 == 0) { heatItems(); } if(tick == 0) { interactWithEntitiesInside(); } if(needsFuel) { consumeFuel(); } } tick = (tick + 1) % 20; }
Source:
<code>public static List<String> getReferencedTypes(final File file) { <START> ArrayList<String> <END> references = new ArrayList<>(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; dbf.setAttribute("<LINK_0>", Boolean.FALSE); try { db = dbf.newDocumentBuilder(); Document document; document = db.parse(file); Node rootNode = document.getDocumentElement(); NodeList childNodes = rootNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node n = childNodes.item(i); if (n.getNodeName().equals(LibraryElementTags.RESOURCE_ELEMENT)) { String type = ""; type = n.getAttributes().getNamedItem(LibraryElementTags.TYPE_ATTRIBUTE).getNodeValue(); references.add(type); } } } catch (Exception e) { Activator.getDefault().logError(e.getMessage(), e); } return references; }</code><technical_language>Wrong type. List<String></technical_language>

Target:
public static List<String> getReferencedTypes(final File file) { List<String> references = new ArrayList<>(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; dbf.setAttribute("<LINK_0>", Boolean.FALSE); try { db = dbf.newDocumentBuilder(); Document document; document = db.parse(file); Node rootNode = document.getDocumentElement(); NodeList childNodes = rootNode.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node n = childNodes.item(i); if (n.getNodeName().equals(LibraryElementTags.RESOURCE_ELEMENT)) { String type = ""; type = n.getAttributes().getNamedItem(LibraryElementTags.TYPE_ATTRIBUTE).getNodeValue(); references.add(type); } } } catch (Exception e) { Activator.getDefault().logError(e.getMessage(), e); } return references; }