auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testIndexedGZIPVCF(final String testPath, final int expectedCount) throws IOException { final VCFCodec codec = new VCFCodec(); <START> final TribbleIndexedFeatureReader<VariantContext, LineIterator> featureReaderHttp = <END> new TribbleIndexedFeatureReader(testPath, codec, false); final CloseableTribbleIterator<VariantContext> localIterator = featureReaderHttp.iterator(); int count = 0; for (final Feature feat : featureReaderHttp.iterator()) { localIterator.next(); count++; } Assert.assertEquals(count, expectedCount); }</code><technical_language>is this "http" feature reader? reading local files, it</technical_language>

Target:
public void testIndexedGZIPVCF(final String testPath, final int expectedCount) throws IOException { final VCFCodec codec = new VCFCodec(); try (final TribbleIndexedFeatureReader<VariantContext, LineIterator> featureReader = new TribbleIndexedFeatureReader(testPath, codec, false)) { final CloseableTribbleIterator<VariantContext> localIterator = featureReader.iterator(); int count = 0; for (final Feature feat : featureReader.iterator()) { localIterator.next(); count++; } Assert.assertEquals(count, expectedCount); } }
Source:
<code>public CustomizePerspectiveDialog(IWorkbenchWindowConfigurer configurer, Perspective persp, IEclipseContext context) { super(configurer.getWindow().getShell()); this.treeManager = new TreeManager(); this.configurer = configurer; this.context = context; perspective = persp; window = (WorkbenchWindow) configurer.getWindow(); wPage = <START> (WorkbenchPage) window.getActivePage(); <END> menuMngrRenderer = context.get(MenuManagerRenderer.class); toolbarMngrRenderer = context.get(ToolBarManagerRenderer.class); resUtils = (ISWTResourceUtilities) context.get(IResourceUtilities.class); initializeIcons(); initializeActionSetInput(); loadMenuAndToolbarStructure(); }</code><technical_language>Silly call this workbenchPage, wPage Ctrl+K lands frequently method sho(wPage) I Ctrl+K follow a variable</technical_language>

Target:
public CustomizePerspectiveDialog(IWorkbenchWindowConfigurer configurer, Perspective persp, IEclipseContext context) { super(configurer.getWindow().getShell()); this.treeManager = new TreeManager(); this.configurer = configurer; this.context = context; perspective = persp; window = (WorkbenchWindow) configurer.getWindow(); windowPage = (WorkbenchPage) window.getActivePage(); menuMngrRenderer = context.get(MenuManagerRenderer.class); toolbarMngrRenderer = context.get(ToolBarManagerRenderer.class); resUtils = (ISWTResourceUtilities) context.get(IResourceUtilities.class); initializeIcons(); initializeActionSetInput(); loadMenuAndToolbarStructure(); }
Source:
<code>private boolean isHostHealthy(InetSocketAddress host) { try { CassandraClientPoolingContainer testingContainer = currentPools.get(host); testingContainer.runWithPooledResource(describeRing); testingContainer.runWithPooledResource(validatePartitioner); return true; } catch (Exception e) { log.error("We tried to add back into the pool, but got an exception" <START> + " that caused us to distrust this host further.", SafeArg.of("host", host), e); <END> return false; } }</code><technical_language>warn maybe? if want exception. message</technical_language>

Target:
private boolean isHostHealthy(InetSocketAddress host) { try { CassandraClientPoolingContainer testingContainer = currentPools.get(host); testingContainer.runWithPooledResource(describeRing); testingContainer.runWithPooledResource(validatePartitioner); return true; } catch (Exception e) { log.warn("We tried to add back into the pool, but got an exception" + " that caused us to distrust this host further. Exception message was: : {}", SafeArg.of("host", host), SafeArg.of("exceptionClass", e.getClass().getTypeName()), UnsafeArg.of("exceptionMessage", e.getMessage())); return false; } }
Source:
<code>private Triple<Boolean, Integer, Double> checkFixedCompounded(ResolvedSwapLeg leg) { if(leg.getPaymentPeriods().size() != 1) { return Triple.of(false, 0, 0.0d); }; if(leg.getPaymentEvents().size() != 0) { return Triple.of(false, 0, 0.0d); } PaymentPeriod paymentPeriods = leg.getPaymentPeriods().get(0); <START> if(!(paymentPeriods instanceof RatePaymentPeriod)) { <END> return Triple.of(false, 0, 0.0d); } RatePaymentPeriod ratePaymentPeriod = (RatePaymentPeriod) paymentPeriods; if (ratePaymentPeriod.getCompoundingMethod() == CompoundingMethod.NONE) { return Triple.of(false, 0, 0.0d); } ImmutableList<RateAccrualPeriod> accrualPeriods = ratePaymentPeriod.getAccrualPeriods(); int nbAccrualPeriods = accrualPeriods.size(); double fixedRate = 0; for (int i = 0; i < nbAccrualPeriods; i++) { if (!(accrualPeriods.get(i).getRateComputation() instanceof FixedRateComputation)) { return Triple.of(false, 0, 0.0d); } if ((i > 0) && (((FixedRateComputation) accrualPeriods.get(i).getRateComputation()).getRate() != fixedRate)) { return Triple.of(false, 0, 0.0d); } fixedRate = ((FixedRateComputation) accrualPeriods.get(i).getRateComputation()).getRate(); if (accrualPeriods.get(i).getSpread() != 0) { return Triple.of(false, 0, 0.0d); } if (accrualPeriods.get(i).getGearing() != 1.0d) { return Triple.of(false, 0, 0.0d); } if (accrualPeriods.get(i).getYearFraction() != 1.0d) { return Triple.of(false, 0, 0.0d); } } return Triple.of(true, nbAccrualPeriods, fixedRate); }</code><technical_language>Is this checked twice</technical_language>

Target:
private Triple<Boolean, Integer, Double> checkFixedCompounded(ResolvedSwapLeg leg) { if(leg.getPaymentEvents().size() != 0) { return Triple.of(false, 0, 0.0d); } RatePaymentPeriod ratePaymentPeriod = (RatePaymentPeriod) leg.getPaymentPeriods().get(0); if (ratePaymentPeriod.getCompoundingMethod() == CompoundingMethod.NONE) { return Triple.of(false, 0, 0.0d); } ImmutableList<RateAccrualPeriod> accrualPeriods = ratePaymentPeriod.getAccrualPeriods(); int nbAccrualPeriods = accrualPeriods.size(); double fixedRate = 0; for (int i = 0; i < nbAccrualPeriods; i++) { if (!(accrualPeriods.get(i).getRateComputation() instanceof FixedRateComputation)) { return Triple.of(false, 0, 0.0d); } if ((i > 0) && (((FixedRateComputation) accrualPeriods.get(i).getRateComputation()).getRate() != fixedRate)) { return Triple.of(false, 0, 0.0d); } fixedRate = ((FixedRateComputation) accrualPeriods.get(i).getRateComputation()).getRate(); if (accrualPeriods.get(i).getSpread() != 0) { return Triple.of(false, 0, 0.0d); } if (accrualPeriods.get(i).getGearing() != 1.0d) { return Triple.of(false, 0, 0.0d); } if (accrualPeriods.get(i).getYearFraction() != 1.0d) { return Triple.of(false, 0, 0.0d); } } return Triple.of(true, nbAccrualPeriods, fixedRate); }
Source:
<code>private ArrayList<ReceiverGroup> getReceiverGroups() { ArrayList<ReceiverGroup> receiverGroups = new ArrayList<ReceiverGroup>(); for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { if (thriftClientInfo.isStatsPublisherEnabled()) { <START> ArrayList<DataPublisherHolder> dataPublisherHolders = new ArrayList<DataPublisherHolder>(); <END> DataPublisherHolder aNode = new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), thriftClientInfo.getPassword()); dataPublisherHolders.add(aNode); ReceiverGroup group = new ReceiverGroup(dataPublisherHolders); receiverGroups.add(group); } } return receiverGroups; }</code><technical_language>is ArrayList dataPublisherHolders created for loop</technical_language>

Target:
private ArrayList<ReceiverGroup> getReceiverGroups() { for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { if (thriftClientInfo.isStatsPublisherEnabled()) { dataPublisherHolders.add(new DataPublisherHolder(null, buildUrl(thriftClientInfo), thriftClientInfo.getUsername(), thriftClientInfo.getPassword())); if (log.isDebugEnabled()) { log.debug(String.format("Thrift client [id] %s [ip] %s [port] %s is added to data publisher holder", thriftClientInfo.getId(), thriftClientInfo.getIp(), thriftClientInfo.getPort())); } } } receiverGroups.add(new ReceiverGroup(dataPublisherHolders)); return receiverGroups; }
Source:
<code>public static Interceptor.Chain buildChain( @NonNull List<Interceptor> registeredInterceptors, @NonNull Interceptor realInterceptor ) { final List<Interceptor> interceptors = new ArrayList<Interceptor>(registeredInterceptors.size() + 1); interceptors.addAll(registeredInterceptors); interceptors.add(realInterceptor); <START> return new ChainImpl(interceptors, 0); <END> }</code><technical_language>wrap unmodifiable container</technical_language>

Target:
public static Interceptor.Chain buildChain( @NonNull List<Interceptor> registeredInterceptors, @NonNull Interceptor realInterceptor ) { final List<Interceptor> interceptors = new ArrayList<Interceptor>(registeredInterceptors.size() + 1); interceptors.addAll(registeredInterceptors); interceptors.add(realInterceptor); return new ChainImpl(interceptors.listIterator()); }
Source:
<code>private MultiPolygon parseElement(Element extentObj) throws Exception { GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME); gc.getBean(DataManager.class).getEditLib().removeEditingInfo(extentObj); MultiPolygon geometry = null; if ("polygon".equals(extentObj.getName())) { geometry = parsePolygon(extentObj); } else if ("EX_BoundingPolygon".equals(extentObj.getName())) { <START> Element polygon = extentObj.getChild("polygon", Namespaces.GMD); <END> geometry = parsePolygon(polygon); } else if ("EX_GeographicBoundingBox".equals(extentObj.getName())) { double minx = Double.parseDouble(extentObj.getChild("westBoundLongitude", Geonet.Namespaces.GMD).getChildText("Decimal", Geonet.Namespaces.GCO)); double maxx = Double.parseDouble(extentObj.getChild("eastBoundLongitude", Geonet.Namespaces.GMD).getChildText("Decimal", Geonet.Namespaces.GCO)); double miny = Double.parseDouble(extentObj.getChild("southBoundLatitude", Geonet.Namespaces.GMD).getChildText("Decimal", Geonet.Namespaces.GCO)); double maxy = Double.parseDouble(extentObj.getChild("northBoundLatitude", Geonet.Namespaces.GMD).getChildText("Decimal", Geonet.Namespaces.GCO)); Polygon[] polygons = {(Polygon)factory.toGeometry(new Envelope(minx, maxx, miny, maxy))}; geometry = factory.createMultiPolygon(polygons); } return geometry; }</code><technical_language>add ISO19115-3 case ? gex:polygon gex:westBoundLongitude</technical_language>

Target:
private MultiPolygon parseElement(Element extentObj) throws Exception { GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME); gc.getBean(DataManager.class).getEditLib().removeEditingInfo(extentObj); MultiPolygon geometry = null; if ("polygon".equals(extentObj.getName())) { geometry = parsePolygon(extentObj); } else if ("EX_BoundingPolygon".equals(extentObj.getName())) { Element polygon = Xml.selectElement(extentObj, "*[local-name()='polygon']"); geometry = parsePolygon(polygon); } else if ("EX_GeographicBoundingBox".equals(extentObj.getName())) { double minx = Double.parseDouble(Xml.selectString(extentObj, "*[local-name()='westBoundLongitude']/*")); double maxx = Double.parseDouble(Xml.selectString(extentObj, "*[local-name()='eastBoundLongitude']/*")); double miny = Double.parseDouble(Xml.selectString(extentObj, "*[local-name()='southBoundLatitude']/*")); double maxy = Double.parseDouble(Xml.selectString(extentObj, "*[local-name()='northBoundLatitude']/*")); Polygon[] polygons = {(Polygon)factory.toGeometry(new Envelope(minx, maxx, miny, maxy))}; geometry = factory.createMultiPolygon(polygons); } return geometry; }
Source:
<code>public CompletableFuture<Void> putAllAsync(List<Entry<K, V>> entries) { <START> putAll(entries); <END> return CompletableFuture.completedFuture(null); }</code><technical_language>This happen future</technical_language>

Target:
public CompletableFuture<Void> putAllAsync(List<Entry<K, V>> entries) { CompletableFuture<Void> future = new CompletableFuture<>(); try { List<K> delKeys = new ArrayList<>(); List<Entry<K, V>> putRecords = new ArrayList<>(); entries.forEach(r -> { if (r.getValue() != null) { putRecords.add(r); } else { delKeys.add(r.getKey()); } }); cache.invalidateAll(delKeys); putRecords.forEach(e -> put(e.getKey(), e.getValue())); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
Source:
<code>private String messageFormatter(String msg, String vmid){ String temp = ""; <START> return temp.format("{\"params\": {\"notify_time\": %s, \"%s\": {\"status\": [\"%s\"], \"hash\": \"%s\"}}, \"jsonrpc\": \"2.0\", \"method\": \"|virt|VM_status|%s\"}", <END> String.valueOf(System.currentTimeMillis()), vmid, msg, Integer.toString(vmid.hashCode()), vmid); }</code><technical_language>String#format is slow. For running perf tests I suggest '+' operator is replaced StringBuilder directly</technical_language>

Target:
private String messageFormatter(String msg, String vmid){ StringBuilder sb = new StringBuilder(); return sb.append("{\"params\": {\"notify_time\": ") .append(String.valueOf(System.currentTimeMillis())) .append(", \"") .append(vmid) .append("\": {\"status\": [\"") .append(msg) .append("\"], \"hash\": \"") .append(Integer.toString(vmid.hashCode())) .append("\"}}, \"jsonrpc\": \"2.0\", \"method\": \"|virt|VM_status|") .append(vmid) .append("\"}").toString(); }
Source:
<code>public void shouldReturnTeamId_withTeamInContext() { final String userId = randomId(); final String teamId = randomId(); <START> final String identityProviderId = randomId(); <END> final String agentUserId = randomBoolean() ? null : randomId(); final String appId = randomBoolean() ? null : randomId(); final DefaultSecurityContext context = new DefaultSecurityContext(userId, teamId, identityProviderId, agentUserId, appId); final Optional<String> returnedTeamId = context.teamId(); assertEquals(Optional.of(teamId), returnedTeamId); }</code><technical_language>I missing is a test validate setting of identityProviderId get identityProviderId() method. A check missing in this test class</technical_language>

Target:
public void shouldReturnTeamId_withTeamInContext() { final String userId = randomId(); final String teamId = randomId(); final String identityProviderId = randomBoolean() ? null : randomId(); final String agentUserId = randomBoolean() ? null : randomId(); final String appId = randomBoolean() ? null : randomId(); final DefaultSecurityContext context = new DefaultSecurityContext(userId, teamId, identityProviderId, agentUserId, appId); final Optional<String> returnedTeamId = context.teamId(); assertEquals(Optional.of(teamId), returnedTeamId); }
Source:
<code>public List<String> validateResponsesDetails(List<FeedbackResponseDetails> responses, int numRecipients) { List<String> errors = new ArrayList<>(); for (FeedbackResponseDetails response : responses) { FeedbackNumericalScaleResponseDetails details = (FeedbackNumericalScaleResponseDetails) response; boolean isAnswerOutOfRange = details.getAnswer() < minScale || details.getAnswer() > maxScale; if (isAnswerOutOfRange) { errors.add(details.getAnswerString() + Const.FeedbackQuestion.NUMSCALE_ERROR_OUT_OF_RANGE + "(min=" + minScale + ", max=" + maxScale + ")"); } BigDecimal answer = BigDecimal.valueOf(details.getAnswer()); BigDecimal stepBd = BigDecimal.valueOf(step); <START> BigDecimal remainder = answer.remainder(stepBd); <END> boolean isAnsMultipleOfStep = remainder.compareTo(BigDecimal.ZERO) == 0; if (!isAnsMultipleOfStep && !isAnswerOutOfRange) { double posValSmall = answer.subtract(remainder).setScale(5, RoundingMode.HALF_UP).doubleValue(); double posValBig = answer.subtract(remainder).add(stepBd).setScale(5, RoundingMode.HALF_UP).doubleValue(); errors.add("Please enter a valid value. The two nearest valid values are " + posValSmall + " and " + posValBig + "."); } } return errors; }</code><technical_language>logic is wrong here. remainder answer - minScale, simply answer. This logic return error setting of minscale = 6, maxscale = 10, step = 0.7, answer = 7, while returned error nearest answers 6.7 7.4</technical_language>

Target:
public List<String> validateResponsesDetails(List<FeedbackResponseDetails> responses, int numRecipients) { List<String> errors = new ArrayList<>(); for (FeedbackResponseDetails response : responses) { FeedbackNumericalScaleResponseDetails details = (FeedbackNumericalScaleResponseDetails) response; boolean isAnswerOutOfRange = details.getAnswer() < minScale || details.getAnswer() > maxScale; if (isAnswerOutOfRange) { errors.add(details.getAnswerString() + Const.FeedbackQuestion.NUMSCALE_ERROR_OUT_OF_RANGE + "(min=" + minScale + ", max=" + maxScale + ")"); } BigDecimal minval = BigDecimal.valueOf(this.minScale); BigDecimal answer = BigDecimal.valueOf(details.getAnswer()); BigDecimal stepBd = BigDecimal.valueOf(step); BigDecimal remainder = answer.subtract(minval).remainder(stepBd); boolean isAnsMultipleOfStep = remainder.compareTo(BigDecimal.ZERO) == 0; if (!isAnsMultipleOfStep && !isAnswerOutOfRange) { double posValSmall = answer.subtract(remainder).setScale(5, RoundingMode.HALF_UP).doubleValue(); double posValBig = answer.subtract(remainder).add(stepBd).setScale(5, RoundingMode.HALF_UP).doubleValue(); errors.add("Please enter a valid value. The two nearest valid values are " + posValSmall + " and " + posValBig + "."); } } return errors; }
Source:
<code>void handleNext(Title title, List<Description> descriptions) { Timber.e("Inside handleNext"); view.showProgressDialog(); prevTitleDescription setTitleAndDescription(title, descriptions); uploadModel.getImageQuality(uploadModel.getCurrentItem(), true) compositeDisposable.add(uploadModel.getImageQuality(uploadModel.getCurrentItem(), true) <START> master <END> .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(imageResult -> handleImage(title, descriptions, imageResult), throwable -> Timber.e(throwable, "Error occurred while handling image"))); }</code><technical_language>is this intended</technical_language>

Target:
void handleNext(Title title, List<Description> descriptions) { Timber.e("Inside handleNext"); view.showProgressDialog(); setTitleAndDescription(title, descriptions); compositeDisposable.add(uploadModel.getImageQuality(uploadModel.getCurrentItem(), true) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(imageResult -> handleImage(title, descriptions, imageResult), throwable -> Timber.e(throwable, "Error occurred while handling image"))); }
Source:
<code>public boolean pathExists(String path) { String url = getContextBaseUrl() + (path.startsWith("/") ? path : '/' + path); logger.debug("Path to artifact: " + url); WebTarget resource = getClientInstance().target(url); setupAuthentication(resource); Response response = resource.request(MediaType.TEXT_PLAIN).get(); <START> System.out.println(response.getStatus()); <END> return response.getStatus() == 200; }</code><technical_language>I need this</technical_language>

Target:
public boolean pathExists(String path) { String url = getContextBaseUrl() + (path.startsWith("/") ? path : '/' + path); logger.debug("Path to artifact: " + url); WebTarget resource = getClientInstance().target(url); setupAuthentication(resource); Response response = resource.request(MediaType.TEXT_PLAIN).get(); return response.getStatus() == 200; }
Source:
<code>public static void deleteOnExit(final Path path) { Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { <START> Files.delete(path); <END> } catch (IOException e) { throw new RuntimeIOException(e); } } }); }</code><technical_language>exception is tested, delete is not..</technical_language>

Target:
public static void deleteOnExit(final Path path) { Runtime.getRuntime().addShutdownHook(new DeletePathThread(path)); }
Source:
<code>public static RGB getRGBFromCssString(String cssValue) { try { if (cssValue.startsWith("rgb(")) { String rest = cssValue.substring(4, cssValue.length()); if (rest.contains("rgb(")) { <START> rest = rest.substring(rest.indexOf("rgb(") + 4, rest.length()); END> } String[] rgbValues = rest.substring(0, rest.indexOf(")")).split(","); if (rgbValues.length == 3) { return new RGB(Integer.parseInt(rgbValues[0].trim()), Integer.parseInt(rgbValues[1].trim()), Integer.parseInt(rgbValues[2].trim())); } } else if (cssValue.startsWith("#")) { String rest = cssValue.substring(1, cssValue.length()); if (rest.contains("#")) { rest = rest.substring(rest.indexOf("#") + 1, rest.length()); } if (rest.length() > 5) { return new RGB(Integer.parseInt(rest.substring(0, 2), 16), Integer.parseInt(rest.substring(2, 4), 16), Integer.parseInt(rest.substring(4, 6), 16)); } } throw new E4CssParseException("RGB", cssValue); } catch (NumberFormatException | E4CssParseException e) { logOnce(e); return null; } }</code><technical_language>Instead of calling contains indexOf, call indexOf check if -1</technical_language>

Target:
public static RGB getRGBFromCssString(String cssValue) { try { if (cssValue.startsWith("rgb(")) { String rest = cssValue.substring(4, cssValue.length()); int idx = rest.indexOf("rgb("); if (idx != -1) { rest = rest.substring(idx + 4, rest.length()); } idx = rest.indexOf(")"); if (idx != -1) { rest = rest.substring(0, idx); } String[] rgbValues = rest.split(","); if (rgbValues.length == 3) { return new RGB(Integer.parseInt(rgbValues[0].trim()), Integer.parseInt(rgbValues[1].trim()), Integer.parseInt(rgbValues[2].trim())); } } else if (cssValue.startsWith("#")) { String rest = cssValue.substring(1, cssValue.length()); int idx = rest.indexOf("#"); if (idx != -1) { rest = rest.substring(idx + 1, rest.length()); } if (rest.length() > 5) { return new RGB(Integer.parseInt(rest.substring(0, 2), 16), Integer.parseInt(rest.substring(2, 4), 16), Integer.parseInt(rest.substring(4, 6), 16)); } } throw new E4CssParseException("RGB", cssValue); } catch (NumberFormatException | E4CssParseException e) { logOnce(e); return null; } }
Source:
<code>public void copy(String sourceResourcePath, String destinationFileName) throws IOException { Path destinationPath = this.basePath.resolve(destinationFileName); Files.createDirectories(destinationPath.getParent()); <START> Files.copy(EmbulkMigrate.class.getClassLoader().getResourceAsStream(sourceResourcePath), destinationPath,REPLACE_EXISTING); <END> this.modifiedFiles.add(destinationPath); }</code><technical_language>Add a space a newline comma. (If StandardCopyOption.REPLACE_EXISTING, a newline better.)</technical_language>

Target:
public void copy(String sourceResourcePath, String destinationFileName) throws IOException { Path destinationPath = this.basePath.resolve(destinationFileName); Files.createDirectories(destinationPath.getParent()); Files.copy(EmbulkMigrate.class.getClassLoader().getResourceAsStream(sourceResourcePath), destinationPath, StandardCopyOption.REPLACE_EXISTING); this.modifiedFiles.add(destinationPath); }
Source:
<code>public void parseJobs() throws IOException { final String json = Resources .toString(Resources.getResource(JsonUtilsTest.class, "jobs.json"), Charset.defaultCharset()); final InjectableValues injectables = new InjectableValues.Std().addValue("client", EasyMock.createNiceMock(Client.class)); final JavaType javaType = new ObjectMapper().getTypeFactory() .constructCollectionType(ArrayList.class, Job.class); final List<Job> jobs = JsonUtils.parse(json, javaType, injectables); assertThat(jobs, notNullValue()); assertThat(jobs, hasSize(2)); <START> final List<String> jobIds = new ArrayList<String>(); <END> jobIds.add(jobs.get(0).getJid()); jobIds.add(jobs.get(1).getJid()); assertThat(jobIds, containsInAnyOrder("8fbb94d60c3249f9a466c74ef57740f1", "8fbb94d60c3249f9a466c74ef57740f2")); }</code><technical_language>java final List<String> jobIds = new ArrayList<>();</technical_language>

Target:
public void parseJobs() throws IOException { final String json = Resources .toString(Resources.getResource(JsonUtilsTest.class, "jobs.json"), Charset.defaultCharset()); final InjectableValues injectables = new InjectableValues.Std().addValue("client", EasyMock.createNiceMock(Client.class)); final JavaType javaType = new ObjectMapper().getTypeFactory() .constructCollectionType(ArrayList.class, Job.class); final List<Job> jobs = JsonUtils.parse(json, javaType, injectables); assertThat(jobs, notNullValue()); assertThat(jobs, hasSize(2)); final List<String> jobIds = new ArrayList<>(); jobIds.add(jobs.get(0).getJid()); jobIds.add(jobs.get(1).getJid()); assertThat(jobIds, containsInAnyOrder("8fbb94d60c3249f9a466c74ef57740f1", "8fbb94d60c3249f9a466c74ef57740f2")); }
Source:
<code>public OpenShiftProject create(String workspaceId) throws InfrastructureException { final String projectName; try { projectName = evalNamespaceName(workspaceId, EnvironmentContext.getCurrent().getSubject()); } catch (NotFoundException | ServerException | ConflictException | ValidationException e) { throw new InfrastructureException( format("Failed to evaluate the project name to use for workspace %s.", workspaceId), e); } OpenShiftProject osProject = doCreateProject(workspaceId, projectName); osProject.prepare(); <START> if (isCreatingNamespace(workspaceId) && !isNullOrEmpty(getServiceAccountName())) { <END> OpenShiftWorkspaceServiceAccount osWorkspaceServiceAccount = doCreateServiceAccount(workspaceId, projectName); osWorkspaceServiceAccount.prepare(); } return osProject; }</code><technical_language>suggestion if (!isNullOrEmpty(getServiceAccountName() && isCreatingNamespace(workspaceId))) { isCreatingNamespace method heavy logic in fact need evaluate if serviceAccountName is null empty. workspace SA is rarely empty null minor optimization</technical_language>

Target:
public OpenShiftProject create(String workspaceId) throws InfrastructureException { final String projectName; try { projectName = evalNamespaceName(workspaceId, EnvironmentContext.getCurrent().getSubject()); } catch (NotFoundException | ServerException | ConflictException | ValidationException e) { throw new InfrastructureException( format( "Failed to evaluate the project name to use for workspace %s. The error message" + " was: %s", workspaceId, e.getMessage()), e); } OpenShiftProject osProject = doCreateProject(workspaceId, projectName); osProject.prepare(); if (isCreatingNamespace(workspaceId) && !isNullOrEmpty(getServiceAccountName())) { OpenShiftWorkspaceServiceAccount osWorkspaceServiceAccount = doCreateServiceAccount(workspaceId, projectName); osWorkspaceServiceAccount.prepare(); } return osProject; }
Source:
<code>public void testSmallTraces() { assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists()); assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists()); try (CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace(); CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();) { Set<ITmfTrace> traces = new HashSet<>(); traces.add(trace1); <START> traces.add(trace2); <END> runTest(traces, "Match TCP events", 40); } }</code><technical_language>ImmutableSet.of(...) do this in 1 statement</technical_language>

Target:
public void testSmallTraces() { assumeTrue(CtfTmfTestTrace.SYNC_SRC.exists()); assumeTrue(CtfTmfTestTrace.SYNC_DEST.exists()); try (CtfTmfTrace trace1 = CtfTmfTestTrace.SYNC_SRC.getTrace(); CtfTmfTrace trace2 = CtfTmfTestTrace.SYNC_DEST.getTrace();) { Set<ITmfTrace> traces = ImmutableSet.of((ITmfTrace) trace1, trace2); runCpuTest(traces, "Match TCP events", 40); } }
Source:
<code>private void checkScopeAnnotation(ClassTree tree) { <START> List<AnnotationTree> annotations = tree.modifiers().annotations(); <END> for (AnnotationTree annotationTree : annotations) { if (annotationTree.annotationType().symbolType().fullyQualifiedName().equals(SCOPE_ANNOTATION_FQN)) { context.reportIssue(this, annotationTree, "Remove this \"@Scope\" annotation."); } } }</code><technical_language>Stream API usage nicer here</technical_language>

Target:
private void checkScopeAnnotation(ClassTree tree) { tree.modifiers().annotations().stream() .filter(a -> a.annotationType().symbolType().fullyQualifiedName().equals(SCOPE_ANNOTATION_FQN)) .forEach(a -> reportIssue(a, "Remove this \"@Scope\" annotation.")); }
Source:
<code>public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { long lastModified = 0; try { if (head instanceof BranchSCMHead && request instanceof GitHubSCMSourceRequest) { for (GHBranch b : ((GitHubSCMSourceRequest) request).getBranches()) { if (b.getName().equals(head.getName())) { lastModified = b.getOwner().getCommit(b.getSHA1()).getCommitDate().getTime(); } } } else if (head instanceof TagSCMHead && request instanceof GitHubSCMSourceRequest) { lastModified = ((TagSCMHead)head).getTimestamp(); } } catch (IOException e) { LOGGER.log(Level.WARNING, "Could not get commit date of latest commit in branch {0}", new Object[]{head.getName()} ); return false; } long daysOld = TimeUnit.MILLISECONDS.toDays(new Date().getTime() - lastModified); if (lastModified != 0 && <START> maxDaysOld != 0 && <END> daysOld > maxDaysOld) { return true; } return false; }</code><technical_language>suggestion maxDaysOld > 0 &&</technical_language>

Target:
public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { long lastModified = 0; try { if (head instanceof BranchSCMHead && request instanceof GitHubSCMSourceRequest) { Iterable<GHBranch> ghBranches = null; if (this.branches == null) { ghBranches = ((GitHubSCMSourceRequest) request).getBranches(); } else { ghBranches = branches; } for (GHBranch b : ghBranches) { if (b.getName().equals(head.getName())) { lastModified = b.getOwner().getCommit(b.getSHA1()).getCommitDate().getTime(); } } } else if (head instanceof TagSCMHead && request instanceof GitHubSCMSourceRequest) { lastModified = ((TagSCMHead)head).getTimestamp(); } } catch (IOException e) { LOGGER.log(Level.WARNING, "Could not get commit date of latest commit in branch {0}", new Object[]{head.getName()} ); return false; } long daysOld = TimeUnit.MILLISECONDS.toDays(new Date().getTime() - lastModified); if (lastModified != 0 && maxDaysOld > 0 && daysOld > maxDaysOld) { return true; } return false; }
Source:
<code>public CertificateClientBuilder credential(TokenCredential credential) { <START> Objects.requireNonNull(credential); <END> this.credential = credential; return this; }</code><technical_language>Include error message for null checks Objects.requireNonNull Objects.requireNonNull(credential, "credential null");</technical_language>

Target:
public CertificateClientBuilder credential(TokenCredential credential) { Objects.requireNonNull(credential, "Token credential cannot be null"); this.credential = credential; return this; }
Source:
<code><START> public static Restaurant createFakeRestaurant(ParseUser u) throws ParseException { <END> ParseUser restUser = new ParseUser(); restUser.setUsername("testRestUser"); restUser.setPassword("12345"); restUser.setObjectId("_marksrest"); return new Restaurant(restUser); }</code><technical_language>set object Id</technical_language>

Target:
public static Restaurant createFakeRestaurant(ParseUser u) throws ParseException { return createFakeRestaurant(); }
Source:
<code>private Address getHighest(){ <START> if(this.addressTable.size() < AddressTable.DEFAULT_MAX_SIZE) <END> return isAutoRemappingEnabled() ? this.getReferenceAddress().getComplement(): highest; else return isAutoRemappingEnabled() && !addressTable.isEmpty() ? addressTable.lastEntry().getValue() : highest; }</code><technical_language>add a leeway here? if table is 90% full totally full</technical_language>

Target:
private Address getHighest(){ if(this.addressTable.size() < (this.addressTable.getMaxSize()*.9)) return isAutoRemappingEnabled() ? this.getReferenceAddress().getComplement(): highest; else return isAutoRemappingEnabled() ? addressTable.lastEntry().getValue() : highest; }
Source:
<code>private SQLAdmin buildSQLAdmin() { try { JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); GoogleCredential credential; if (jsonKey != null) { credential = GoogleCredential.fromStream( new ByteArrayInputStream(jsonKey.getBytes()), httpTransport, JSON_FACTORY) .createScoped(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN)); } else { Collection SQLSERVICE_ADMIN_SCOPES = Collections.singletonList(SQLAdminScopes.SQLSERVICE_ADMIN); credential = GoogleCredential.getApplicationDefault(httpTransport, JSON_FACTORY); <START> credential = credential.createScoped(SQLSERVICE_ADMIN_SCOPES); <END> } return new SQLAdmin.Builder(httpTransport, JSON_FACTORY, null) .setApplicationName(Names.buildApplicationNameVersionTag(applicationProperties)) .setHttpRequestInitializer(credential) .build(); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>Combine previous line? a bit strange initialize variable consecutive lines</technical_language>

Target:
private SQLAdmin buildSQLAdmin() { try { JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); GoogleCredential credential; if (jsonKey != null) { credential = GoogleCredential.fromStream( new ByteArrayInputStream(jsonKey.getBytes()), httpTransport, JSON_FACTORY) .createScoped(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN)); } else { Collection SQLSERVICE_ADMIN_SCOPES = Collections.singletonList(SQLAdminScopes.SQLSERVICE_ADMIN); credential = GoogleCredential.getApplicationDefault(httpTransport, JSON_FACTORY).createScoped(SQLSERVICE_ADMIN_SCOPES); } return new SQLAdmin.Builder(httpTransport, JSON_FACTORY, null) .setApplicationName(Names.buildApplicationNameVersionTag(applicationProperties)) .setHttpRequestInitializer(credential) .build(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public String toString() { <START> return String.valueOf(this.text); <END> }</code><technical_language>@dalifreire is this enough? e.g class name</technical_language>

Target:
public String toString() { return String.format( "%s(super=%s, text=%s)", RsFlash.class.getSimpleName(), super.toString(), this.text ); }
Source:
<code>public void split(BaseTxPartitionAndMergeTest test) { test.getLog().debug("Splitting cluster isolating a primary owner."); test.splitCluster(new int[]{2}, new int[]{0, 1, 3}); assertDegradedPartition(test, 0); <START> TestingUtil.waitForNoRebalance(test.cache(0 ), test.cache(1), test.cache(3)); <END> test.getLog().debug("Cluster split."); }</code><technical_language>Extra space</technical_language>

Target:
public void split(BaseTxPartitionAndMergeTest test) { test.getLog().debug("Splitting cluster isolating the originator."); test.splitCluster(new int[]{0}, new int[]{1, 2, 3}); assertDegradedPartition(test, 0); TestingUtil.waitForNoRebalance(test.cache(1), test.cache(2), test.cache(3)); test.getLog().debug("Cluster split."); }
Source:
<code>public void testFilter() { ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); FilterFunction filter = new FilterFunction(session, true, new IsOddPredicate()); Block numbers = makeNumbers(0, 1000); int[] allPositions = makePositions(0, 1000, 1); assertFilter(filter, numbers, allPositions, allPositions.length); Block dictionaryNumbers = new DictionaryBlock(numbers, allPositions); int[] sparsePositions = makePositions(1, 300, 3); assertFilter(filter, dictionaryNumbers, sparsePositions, sparsePositions.length); assertFilter(filter, dictionaryNumbers, allPositions, allPositions.length); DictionaryBlock otherDictionary = new DictionaryBlock(numbers, makePositions(1, 332, 3)); int[] otherDictionaryPositions = makePositions(0, 150, 2); assertFilter(filter, otherDictionary, otherDictionaryPositions, otherDictionaryPositions.length); Block numbers2 = makeNumbers(1, 1001); Block dictionary2Numbers = new DictionaryBlock(numbers2, allPositions); <START> assertFilter(filter, dictionary2Numbers, allPositions, allPositions.length); <END> }</code><technical_language>a1, a2, a3 names; here, inline numbers2 dictionary2Numbers avoid naming problem: assertFilter(filter, new DictionaryBlock(makeNumbers(1, 1001), allPositions), allPositions, allPositions.length);</technical_language>

Target:
public void testFilter() { ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); FilterFunction filter = new FilterFunction(session, true, new IsOddPredicate()); Block numbers = makeNumbers(0, 1000); int[] allPositions = makePositions(0, 1000, 1); assertFilter(filter, numbers, allPositions, allPositions.length); Block dictionaryNumbers = new DictionaryBlock(numbers, allPositions); int[] sparsePositions = makePositions(1, 300, 3); assertFilter(filter, dictionaryNumbers, sparsePositions, sparsePositions.length); assertFilter(filter, dictionaryNumbers, allPositions, allPositions.length); DictionaryBlock otherDictionary = new DictionaryBlock(numbers, makePositions(1, 332, 3)); int[] otherDictionaryPositions = makePositions(0, 150, 2); assertFilter(filter, otherDictionary, otherDictionaryPositions, otherDictionaryPositions.length); assertFilter(filter, new DictionaryBlock(makeNumbers(1, 1001), allPositions), allPositions, allPositions.length); }
Source:
<code>protected Runnable getSessionTask() { <START> return new Runnable() { <END> @Override public void run() { session.get().pulse(); } }; }</code><technical_language>minor suggestion. this a private final variable, create runnable once. return variable instead. outcome is same, advantage of creating object tick</technical_language>

Target:
protected Runnable getSessionTask() { return sessionTask; }
Source:
<code>public void shouldReverseANonEmptyList() { <START> final int length = 100; <END> final int startValue = 0; final List<Integer> reversedList = IntStream.range(startValue, length) .boxed() .collect(Collectors.toList()); Collections.reverse(reversedList); final List<Integer> list = Collections.unmodifiableList( IntStream.range(startValue, length) .boxed() .collect(Collectors.toList()) ); final List<Integer> actual = ListOps.reverse(list); final List<Integer> expected = reversedList; assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }</code><technical_language>extracting a a variable is a great move input output need agree. this larger number forces IntStream.range() generate list (and applying operation top of it; sorting). If start a smaller value, _start_ transformed value. Example: java final List<Integer> list = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8); final List<Integer> reversed = Arrays.asList(8, 7, 6, 5, 4, 3, 2, 1, 0);</technical_language>

Target:
public void shouldReverseANonEmptyList() { final List<Integer> list = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8) ); final List<Integer> actual = ListOps.reverse(list); final List<Integer> expected = Arrays.asList(8, 7, 6, 5, 4, 3, 2, 1, 0); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
<code>public String getCode() { <START> return this.getString(Constants.Properties.CODE); <END> }</code><technical_language>a difference for this class, correct implementation super.set / get Instead of this.getString(), of APIs this class calling super.getString() for other APIs - -> super.get*() super.set*()</technical_language>

Target:
public String getCode() { return super.getString(Constants.Properties.CODE); }
Source:
<code>public void handle(HttpURLConnection connection) { if(security.isAuthorized()) { long tokenLifetime = security.remainingTokenLifetime(); LOG.debug("security token will expire in " + tokenLifetime + " ms"); if (tokenLifetime < MIN_TOKEN_LIFETIME) { LOG.debug("Need to refresh security token"); try { security.refreshToken().get(); } catch (Exception e) { throw new DolphinRuntimeException("Can not refresh security token", e); } } <START> } <END> String accessToken = security.getAccessToken(); if(accessToken != null && !accessToken.isEmpty()) { LOG.debug("Adding security access token to request"); connection.setRequestProperty("Authorization", "Bearer " + accessToken); } }</code><technical_language>deprecated methods - remainingTokenLifetime() refreshToken()</technical_language>

Target:
public void handle(HttpURLConnection connection) { if(security.isAuthorized()) { long tokenLifetime = security.tokenExpiresAt() - System.currentTimeMillis(); LOG.debug("security token will expire in " + tokenLifetime + " ms"); if (tokenLifetime < MIN_TOKEN_LIFETIME) { LOG.debug("Need to refresh security token"); try { security.refreshToken().get(); } catch (Exception e) { throw new DolphinRuntimeException("Can not refresh security token", e); } } } String accessToken = security.getAccessToken(); if(accessToken != null && !accessToken.isEmpty()) { LOG.debug("Adding security access token to request"); connection.setRequestProperty("Authorization", "Bearer " + accessToken); } }
Source:
<code>public int getWeight(EStructuralFeature feature) { if (irrelevant(feature) || toBeIgnored.contains(feature)) { return 0; } Integer found = weights.get(feature); if (found == null) { found = Integer.valueOf(SMALL); if ("name".equals(feature.getName()) || "id".equals(feature.getName())) { found = Integer.valueOf(SIGNIFICANT); } if (feature instanceof EReference && ((EReference)feature).isContainment()) { found = Integer.valueOf(NORMAL); } } <START> if (feature instanceof EReference) { <END> found = Integer.valueOf(referenceChangeCoef * found.intValue()); } else { found = Integer.valueOf(attributeChangeCoef * found.intValue()); } return found.intValue(); }</code><technical_language>this is reflective behavior too</technical_language>

Target:
public int getWeight(EStructuralFeature feature) { if (irrelevant(feature)) { return 0; } Integer found = weights.get(feature); if (found == null) { found = Integer.valueOf(SMALL); if (feature == EcorePackage.Literals.ENAMED_ELEMENT__NAME) { found = Integer.valueOf(SIGNIFICANT); } if (feature instanceof EReference && ((EReference)feature).isContainment()) { found = Integer.valueOf(NORMAL); } if (feature instanceof EReference) { found = Integer.valueOf(referenceChangeCoef * found.intValue()); } else { found = Integer.valueOf(attributeChangeCoef * found.intValue()); } weights.put(feature, found); } return found.intValue(); }
Source:
<code>private LogoutResponse logout(URL logoutUrl, String requestBody) throws Exception { Request request = new Request.Builder() .url(logoutUrl) .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") <START> .addHeader("Connection", "close") END> .post(RequestBody.create(JSON, requestBody)) .build(); Call call = client.newCall(request); Response response = call.execute(); return LogoutResponse.from(response); }</code><technical_language>I @cmelchior remove this line time</technical_language>

Target:
private LogoutResponse logout(URL logoutUrl, String requestBody) throws Exception { Request request = new Request.Builder() .url(logoutUrl) .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .post(RequestBody.create(JSON, requestBody)) .build(); Call call = client.newCall(request); Response response = call.execute(); return LogoutResponse.from(response); }
Source:
<code>public Future<ImmutableSet<MarketplaceEntry>> loadMarketplaceEntriesFor(final IPerson user) { final List<IPortletDefinition> allPortletDefinitions = this.portletDefinitionRegistry.getAllPortletDefinitions(); <START> final List<MarketplaceEntry> visiblePortletDefinitions = new ArrayList<>(); <END> for (final IPortletDefinition portletDefinition : allPortletDefinitions) { if (mayBrowsePortlet(user, portletDefinition)) { final MarketplacePortletDefinition marketplacePortletDefinition = getOrCreateMarketplacePortletDefinition(portletDefinition); MarketplaceEntry entry = new MarketplaceEntry(marketplacePortletDefinition); boolean canAdd = mayAddPortlet(user, portletDefinition); entry.setCanAdd(canAdd); visiblePortletDefinitions.add(entry); } } logger.trace("These portlet definitions are browseable by {}.", visiblePortletDefinitions, user); Future<ImmutableSet<MarketplaceEntry>> result = new AsyncResult<>(ImmutableSet.copyOf(visiblePortletDefinitions)); Element cacheElement = new Element(user.getUserName(), result); marketplaceUserPortletDefinitionCache.put(cacheElement); return result; }</code><technical_language>Set expressed a MarketplacePortletDefinition is is visible user. in set not. List expresses a MarketplacePortletDefinition visible N times some ordering of visible definitions. Set is more expressive of nature of visible definitions, no</technical_language>

Target:
public Future<ImmutableSet<MarketplaceEntry>> loadMarketplaceEntriesFor(final IPerson user) { final List<IPortletDefinition> allPortletDefinitions = this.portletDefinitionRegistry.getAllPortletDefinitions(); final Set<MarketplaceEntry> visiblePortletDefinitions = new HashSet<>(); for (final IPortletDefinition portletDefinition : allPortletDefinitions) { if (mayBrowsePortlet(user, portletDefinition)) { final MarketplacePortletDefinition marketplacePortletDefinition = getOrCreateMarketplacePortletDefinition(portletDefinition); MarketplaceEntry entry = new MarketplaceEntry(marketplacePortletDefinition); boolean canAdd = mayAddPortlet(user, portletDefinition); entry.setCanAdd(canAdd); visiblePortletDefinitions.add(entry); } } logger.trace("These portlet definitions are browseable by {}.", visiblePortletDefinitions, user); Future<ImmutableSet<MarketplaceEntry>> result = new AsyncResult<>(ImmutableSet.copyOf(visiblePortletDefinitions)); Element cacheElement = new Element(user.getUserName(), result); marketplaceUserPortletDefinitionCache.put(cacheElement); return result; }
Source:
<code>protected SortedMap<String, MavenProject> getDependencies( MavenProject project ) { return dependenciesTool.loadProjectDependencies( <START> new LoadedProjectDependencies(project.getArtifacts(), project.getDependencyArtifacts()), <END> this, localRepository, remoteRepositories, null ); }</code><technical_language>Code style</technical_language>

Target:
protected SortedMap<String, MavenProject> getDependencies( MavenProject project ) { return dependenciesTool.loadProjectDependencies( new ResolvedProjectDependencies( project.getArtifacts(), project.getDependencyArtifacts() ), this, localRepository, remoteRepositories, null ); }
Source:
<code>public String convertProperties(Map<String, String> properties) { StringBuilder sb = new StringBuilder(); if (properties != null && !properties.isEmpty()) { for (Map.Entry<String, String> e : properties.entrySet()) { sb.append(e.getKey()); sb.append(KEY_VALUE_DELIMETER); <START> sb.append(Optional.ofNullable(e.getValue()).orElse("")); <END> sb.append(PROPERTIES_DELIMETER); } sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }</code><technical_language>forgot update here</technical_language>

Target:
public String convertProperties(Map<String, String> properties) { StringBuilder sb = new StringBuilder(); if (properties != null && !properties.isEmpty()) { for (Map.Entry<String, String> e : properties.entrySet()) { sb.append(e.getKey()); sb.append(KEY_VALUE_DELIMETER); sb.append(Objects.toString(e.getValue(), "")); sb.append(PROPERTIES_DELIMETER); } sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; <START> result = prime * result + getUuid().hashCode(); <END> result = prime * result + ((hostName == null) ? 0 : hostName.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); return result; }</code><technical_language>if uuid is null? Also, is inconsistent getter in case of uuid, instance variables in case of hostName status</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getUuid() == null) ? 0 : getUuid().hashCode()); result = prime * result + ((getHostName() == null) ? 0 : getHostName().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); return result; }
Source:
<code><START> public void doIndex(StaplerRequest req, StaplerResponse rsp) throws IOException { <END> if (!ResourceDomainConfiguration.isResourceRequest(req)) { rsp.sendError(404, "Cannot handle requests to this URL unless on Jenkins resource URL."); } else { rsp.sendError(404, "Jenkins serves only static files on this domain."); } }</code><technical_language>FTR this method is necessary for /static-files/ else this case is covered getDynamic</technical_language>

Target:
public void doIndex(StaplerRequest req, StaplerResponse rsp) throws IOException { if (ResourceDomainConfiguration.isResourceRequest(req)) { rsp.sendError(404, ResourceDomainFilter.ERROR_RESPONSE); } else { rsp.sendError(404, "Cannot handle requests to this URL unless on Jenkins resource URL."); } }