auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Configuration create(final HbaseConfig hbaseConfig) throws IOException { Configuration configuration = HBaseConfiguration.create(); if (isValidFile(hbaseConfig.getCoreSite())) { configuration.addResource(new File(hbaseConfig.getCoreSite()).toURI().toURL()); } if (isValidFile(hbaseConfig.getHdfsSite())) { configuration.addResource(new File(hbaseConfig.getHdfsSite()).toURI().toURL()); } if (isValidFile(hbaseConfig.getHbasePolicy())) { configuration.addResource(new File(hbaseConfig.getHbasePolicy()).toURI().toURL()); } if (isValidFile(hbaseConfig.getHbaseSite())) { configuration.addResource(new File(hbaseConfig.getHbaseSite()).toURI().toURL()); } if (hbaseConfig.isSecure() && isValidFile(hbaseConfig.getKeytabFileName())) { configuration.set("hbase.master.kerberos.principal", hbaseConfig.getAuthString()); configuration.set("hadoop.kerberos.kinit.command", hbaseConfig.getKinitPath()); UserGroupInformation.setConfiguration(configuration); System.setProperty("java.security.krb5.conf", hbaseConfig.getKerberosConfigFile()); if (hbaseConfig.isSecure()) { UserGroupInformation.loginUserFromKeytab( hbaseConfig.getAuthString(), hbaseConfig.getKeytabFileName()); logger.info("Logged into Hbase with User: " + UserGroupInformation.getLoginUser()); } } return configuration; }

Target:
public static Configuration create(final HbaseConfig hbaseConfig) throws IOException { Configuration configuration = HBaseConfiguration.create(); if (isValidFile(hbaseConfig.getCoreSite())) { configuration.addResource(new File(hbaseConfig.getCoreSite()).toURI().toURL()); } if (isValidFile(hbaseConfig.getHdfsSite())) { configuration.addResource(new File(hbaseConfig.getHdfsSite()).toURI().toURL()); } if (isValidFile(hbaseConfig.getHbasePolicy())) { configuration.addResource(new File(hbaseConfig.getHbasePolicy()).toURI().toURL()); } if (isValidFile(hbaseConfig.getHbaseSite())) { configuration.addResource(new File(hbaseConfig.getHbaseSite()).toURI().toURL()); } if (hbaseConfig.isSecure() && isValidFile(hbaseConfig.getKeytabFileName())) { configuration.set("hbase.master.kerberos.principal", hbaseConfig.getAuthString()); configuration.set("hadoop.kerberos.kinit.command", hbaseConfig.getKinitPath()); UserGroupInformation.setConfiguration(configuration); System.setProperty("java.security.krb5.conf", hbaseConfig.getKerberosConfigFile()); UserGroupInformation.loginUserFromKeytab( hbaseConfig.getAuthString(), hbaseConfig.getKeytabFileName()); logger.info("Logged into Hbase with User: " + UserGroupInformation.getLoginUser()); } return configuration; }
Source:
private void addOrUpdateClusterServices(VDSGroup cluster, Map<ServiceType, GlusterServiceStatus> fetchedClusterServiceStatusMap) { Map<ServiceType, GlusterClusterService> existingClusterServiceMap = getClusterServiceMap(cluster); for (Entry<ServiceType, GlusterServiceStatus> entry : fetchedClusterServiceStatusMap.entrySet()) { ServiceType type = entry.getKey(); GlusterServiceStatus status = entry.getValue(); GlusterClusterService foundService = existingClusterServiceMap.get(type); if (foundService == null) { existingClusterServiceMap.put(type, mapServiceTypeToCluster(cluster, type, status)); } else if (foundService.getStatus() != status) { updateClusterServiceStatus(foundService, status); } } }

Target:
private void addOrUpdateClusterServices(VDSGroup cluster, Map<ServiceType, GlusterServiceStatus> fetchedClusterServiceStatusMap) { Map<ServiceType, GlusterClusterService> existingClusterServiceMap = getClusterServiceMap(cluster); for (Entry<ServiceType, GlusterServiceStatus> entry : fetchedClusterServiceStatusMap.entrySet()) { ServiceType type = entry.getKey(); GlusterServiceStatus status = entry.getValue(); GlusterClusterService existingClusterService = existingClusterServiceMap.get(type); if (existingClusterService == null) { existingClusterServiceMap.put(type, addClusterServiceToDb(cluster, type, status)); } else if (existingClusterService.getStatus() != status) { updateClusterServiceStatus(existingClusterService, status); } } }
Source:
public void testTimestampMillisStringifier() { PrimitiveStringifier stringifier = PrimitiveStringifier.TIMESTAMP_MILLIS_STRINGIFIER; assertEquals("1970-01-01T00:00:00.000", stringifier.stringify(0l)); assertEquals("1970-01-01T00:00:00.000+0000", PrimitiveStringifier.TIMESTAMP_MILLIS_UTC_STRINGIFIER.stringify(0l)); Calendar cal = Calendar.getInstance(UTC); cal.clear(); cal.set(2017, Calendar.DECEMBER, 15, 10, 9, 54); cal.set(Calendar.MILLISECOND, 120); assertEquals("2017-12-15T10:09:54.120", stringifier.stringify(cal.getTimeInMillis())); cal.clear(); cal.set(1948, Calendar.NOVEMBER, 23, 20, 19, 1); cal.set(Calendar.MILLISECOND, 9); assertEquals("1948-11-23T20:19:01.009", stringifier.stringify(cal.getTimeInMillis())); checkThrowingUnsupportedException(stringifier, Long.TYPE); }

Target:
public void testTimestampMillisStringifier() { for (PrimitiveStringifier stringifier : asList(TIMESTAMP_MILLIS_STRINGIFIER, TIMESTAMP_MILLIS_UTC_STRINGIFIER)) { String timezoneAmendment = (stringifier == TIMESTAMP_MILLIS_STRINGIFIER ? "" : "+0000"); assertEquals(withZoneString("1970-01-01T00:00:00.000", timezoneAmendment), stringifier.stringify(0l)); Calendar cal = Calendar.getInstance(UTC); cal.clear(); cal.set(2017, Calendar.DECEMBER, 15, 10, 9, 54); cal.set(Calendar.MILLISECOND, 120); assertEquals(withZoneString("2017-12-15T10:09:54.120", timezoneAmendment), stringifier.stringify(cal.getTimeInMillis())); cal.clear(); cal.set(1948, Calendar.NOVEMBER, 23, 20, 19, 1); cal.set(Calendar.MILLISECOND, 9); assertEquals(withZoneString("1948-11-23T20:19:01.009", timezoneAmendment), stringifier.stringify(cal.getTimeInMillis())); checkThrowingUnsupportedException(stringifier, Long.TYPE); } }
Source:
public Factory<PaxosLearnerNetworkClient> learner() { return client -> { List<WithDedicatedExecutor<PaxosLearner>> remoteLearners = TimelockPaxosLearnerAdapters .create(useCase(), remoteClients(), useBatchedEndpoints(), client) .stream() .map(withExecutor -> withExecutor.transformService( remote -> metrics().instrument(PaxosLearner.class, remote, client))) .collect(Collectors.toList()); PaxosLearner localLearner = components().learner(client); LocalAndRemotes<PaxosLearner> allLearners = LocalAndRemotes.of(localLearner, remoteLearners.stream().map(WithDedicatedExecutor::service).collect(Collectors.toList())); Map<PaxosLearner, ExecutorService> executorMap = ImmutableMap.<PaxosLearner, ExecutorService>builder() .putAll(KeyedStream.of(remoteLearners) .mapKeys(WithDedicatedExecutor::service) .map(WithDedicatedExecutor::executor) .collectToMap()) .put(localLearner, MoreExecutors.newDirectExecutorService()) .build(); SingleLeaderLearnerNetworkClient uninstrumentedLearner = new SingleLeaderLearnerNetworkClient( allLearners.local(), allLearners.remotes(), quorumSize(), executorMap, PaxosConstants.CANCEL_REMAINING_CALLS); return metrics().instrument(PaxosLearnerNetworkClient.class, uninstrumentedLearner); }; }

Target:
public Factory<PaxosLearnerNetworkClient> learner() { return client -> { List<WithDedicatedExecutor<PaxosLearner>> remoteLearners = TimelockPaxosLearnerAdapters .create(useCase(), remoteClients(), useBatchedEndpoints(), client) .stream() .map(withExecutor -> withExecutor.transformService( remote -> metrics().instrument(PaxosLearner.class, remote, client))) .collect(Collectors.toList()); PaxosLearner localLearner = components().learner(client); Map<PaxosLearner, ExecutorService> executorMap = ImmutableMap.<PaxosLearner, ExecutorService>builder() .putAll(KeyedStream.of(remoteLearners) .mapKeys(WithDedicatedExecutor::service) .map(WithDedicatedExecutor::executor) .collectToMap()) .put(localLearner, MoreExecutors.newDirectExecutorService()) .build(); SingleLeaderLearnerNetworkClient uninstrumentedLearner = new SingleLeaderLearnerNetworkClient( localLearner, remoteLearners.stream().map(WithDedicatedExecutor::service).collect(Collectors.toList()), quorumSize(), executorMap, PaxosConstants.CANCEL_REMAINING_CALLS); return metrics().instrument(PaxosLearnerNetworkClient.class, uninstrumentedLearner); }; }
Source:
protected void checkStatus(BulkStatus status) { if (status.getState() == State.UNKNOWN || !getContext().getPrincipal().getName().equals(status.getUsername())) { throw new WebResourceNotFoundException("Bulk command with id=" + status.getCommandId() + " doesn't exist"); } }

Target:
protected void checkStatus(BulkStatus status) { if (status.getState() == State.UNKNOWN || !getContext().getPrincipal().isAdministrator() && !getContext().getPrincipal().getName().equals(status.getUsername())) { throw new WebResourceNotFoundException("Bulk command with id=" + status.getCommandId() + " doesn't exist"); } }
Source:
public void testIsString() throws Exception { assertFalse(AvroUtils.isString(Schema.Type.INT)); assertTrue(AvroUtils.isString(Schema.Type.STRING)); }

Target:
public void testIsString() throws Exception { assertFalse(AvroUtils.isString(Schema.Type.ARRAY)); assertFalse(AvroUtils.isString(Schema.Type.BOOLEAN)); assertFalse(AvroUtils.isString(Schema.Type.BYTES)); assertFalse(AvroUtils.isString(Schema.Type.DOUBLE)); assertFalse(AvroUtils.isString(Schema.Type.ENUM)); assertFalse(AvroUtils.isString(Schema.Type.FIXED)); assertFalse(AvroUtils.isString(Schema.Type.FLOAT)); assertFalse(AvroUtils.isString(Schema.Type.INT)); assertFalse(AvroUtils.isString(Schema.Type.LONG)); assertFalse(AvroUtils.isString(Schema.Type.MAP)); assertFalse(AvroUtils.isString(Schema.Type.NULL)); assertFalse(AvroUtils.isString(Schema.Type.RECORD)); assertTrue(AvroUtils.isString(Schema.Type.STRING)); assertFalse(AvroUtils.isString(Schema.Type.UNION)); }
Source:
public Subscription schedulePeriodically(final Action0 action, long initialDelay, long period, TimeUnit unit) { final long periodInNanos = unit.toNanos(period); final long startInNanos = TimeUnit.MILLISECONDS.toNanos(now()) + unit.toNanos(initialDelay); final Action0 recursiveAction = new Action0() { long count = 0; @Override public void call() { if (!isUnsubscribed()) { action.call(); long nextTick = startInNanos + (++count * periodInNanos); schedule(this, nextTick - TimeUnit.MILLISECONDS.toNanos(now()), TimeUnit.NANOSECONDS); } } }; return Subscriptions.from(this, schedule(recursiveAction, initialDelay, unit)); }

Target:
public Subscription schedulePeriodically(final Action0 action, long initialDelay, long period, TimeUnit unit) { final long periodInNanos = unit.toNanos(period); final long startInNanos = TimeUnit.MILLISECONDS.toNanos(now()) + unit.toNanos(initialDelay); final MultipleAssignmentSubscription mas = new MultipleAssignmentSubscription(); final Action0 recursiveAction = new Action0() { long count = 0; @Override public void call() { if (!mas.isUnsubscribed()) { action.call(); long nextTick = startInNanos + (++count * periodInNanos); mas.set(schedule(this, nextTick - TimeUnit.MILLISECONDS.toNanos(now()), TimeUnit.NANOSECONDS)); } } }; mas.set(schedule(recursiveAction, initialDelay, unit)); return mas; }
Source:
public void testWithValidTokenDifferentClient(String opHost, String redirectUrl) throws Exception { DevelopersApi client = Tester.api(); RegisterSiteResponseData siteUnderTest = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final RegisterSiteResponseData differentSite = Tester.getSetupData(); GetClientTokenResponseData tokenResponse = getGetClientTokenResponseData(opHost, client, differentSite); assertNotNull(tokenResponse); final String validHeader = Tester.getAuthorization(differentSite); IntrospectAccessTokenParams iatParams = new IntrospectAccessTokenParams(); iatParams.setAccessToken(tokenResponse.getAccessToken()); iatParams.setOxdId(siteUnderTest.getOxdId()); ApiResponse<IntrospectAccessTokenResponse> apiIatResponse = client.introspectAccessTokenWithHttpInfo(validHeader, iatParams); assertEquals(apiIatResponse.getStatusCode(), 200); assertNotNull(apiIatResponse.getData()); assertTrue("error".equalsIgnoreCase(apiIatResponse.getData().getStatus())); IntrospectAccessTokenResponseData responseData = apiIatResponse.getData().getData(); assertNotNull(responseData); assertTrue(responseData.getError().equals(ErrorResponseCode.INVALID_ID_TOKEN_MISMATCHED_CLIENT_ID.getCode())); }

Target:
public void testWithValidTokenDifferentClient(String opHost, String redirectUrl) throws Exception { DevelopersApi client = Tester.api(); RegisterSiteResponseData siteUnderTest = RegisterSiteTest.registerSite(client, opHost, redirectUrl); final RegisterSiteResponseData differentSite = Tester.getSetupData(); GetClientTokenResponseData tokenResponse = getGetClientTokenResponseData(opHost, client, differentSite); assertNotNull(tokenResponse); final String validHeader = Tester.getAuthorization(differentSite); IntrospectAccessTokenParams iatParams = new IntrospectAccessTokenParams(); iatParams.setAccessToken(tokenResponse.getAccessToken()); iatParams.setOxdId(siteUnderTest.getOxdId()); ApiResponse<IntrospectAccessTokenResponse> apiIatResponse = client.introspectAccessTokenWithHttpInfo(validHeader, iatParams); assertEquals(apiIatResponse.getStatusCode(), 200); assertNotNull(apiIatResponse.getData()); assertTrue("error".equalsIgnoreCase(apiIatResponse.getData().getStatus())); assertNotNull(apiIatResponse.getData().getData()); assertTrue(apiIatResponse.getData().getData().getError().equals(ErrorResponseCode.INVALID_ACCESS_TOKEN_MISMATCHED_CLIENT_ID.getCode())); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { WikipediaApp app = WikipediaApp.getInstance(); int displayWidth = getDialogWidth(); int displayHeight = inflater.getContext().getResources().getDisplayMetrics().heightPixels; int dialogHeight = (int) (dialogPeekHeight * app.getScreenDensity()); rootView = (ViewGroup) inflater.inflate(R.layout.dialog_bottom_swipe, container); rootView.setLayoutParams(new FrameLayout.LayoutParams(displayWidth, displayHeight)); View emptyViewDismissTrigger = new View(inflater.getContext()); emptyViewDismissTrigger.setLayoutParams(new ListView.LayoutParams(displayWidth, 1)); View emptyViewTop = new View(inflater.getContext()); emptyViewTop.setLayoutParams(new ListView.LayoutParams(displayWidth, dialogHeight)); emptyViewTop.setClickable(true); setDismissOnClick(emptyViewTop); View emptyViewMiddle = new View(inflater.getContext()); emptyViewMiddle.setLayoutParams(new ListView.LayoutParams(displayWidth, displayHeight - dialogHeight)); emptyViewMiddle.setClickable(true); setDismissOnClick(emptyViewMiddle); View dialogView = inflateDialogView(inflater, container); dialogViews = new ArrayList<>(); dialogViews.add(emptyViewDismissTrigger); dialogViews.add(emptyViewTop); dialogViews.add(emptyViewMiddle); dialogViews.add(dialogView); dialogListView = (ListView) rootView.findViewById(R.id.bottom_swipe_container_list); dialogListView.setAdapter(new SwipeableAdapter()); dialogListView.setSelection(dialogViews.indexOf(emptyViewMiddle)); dialogView.post(new Runnable() { @Override public void run() { dialogListView.setOnScrollListener(onScrollListener); } }); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { int displayWidth = getDialogWidth(); int displayHeight = inflater.getContext().getResources().getDisplayMetrics().heightPixels; int dialogHeight = (int) (dialogPeekHeight * WikipediaApp.getInstance().getScreenDensity()); rootView = (ViewGroup) inflater.inflate(R.layout.dialog_bottom_swipe, container); dialogViews.add(makeSpaceView(displayWidth, 1)); dialogViews.add(makeSpaceView(displayWidth, dialogHeight)); dialogViews.add(makeSpaceView(displayWidth, displayHeight - dialogHeight)); dialogViews.add(inflateDialogView(inflater, container)); dialogListView = (ListView) rootView.findViewById(R.id.bottom_swipe_container_list); dialogListView.setAdapter(new SwipeableAdapter()); dialogListView.setSelection(2); rootView.post(new Runnable() { @Override public void run() { dialogListView.setOnScrollListener(onScrollListener); } }); return rootView; }
Source:
public void appendError(final FlatPushMessageInformation pushMessageInformation, final Variant variant, final String errorMessage) { final VariantErrorStatus ves = new VariantErrorStatus(pushMessageInformation, variant, errorMessage); pushMessageInformation.getErrors().add(ves); try { flatPushMessageInformationDao.update(pushMessageInformation); } catch (Exception e) { logger.info("A VariantErrorStatus has been already added, for the given Variant in this push job"); } }

Target:
public void appendError(final FlatPushMessageInformation pushMessageInformation, final Variant variant, final String errorMessage) { final VariantErrorStatus ves = new VariantErrorStatus(pushMessageInformation, variant, errorMessage); pushMessageInformation.getErrors().add(ves); try { flatPushMessageInformationDao.update(pushMessageInformation); } catch (Exception e) { logger.info("Failed to save pushMessageInformation: {}", e.getMessage()); logger.debug("Details:", e); } }
Source:
private void saveFeatures( @Nonnull final XWikiDocument docX, @Nonnull final BaseObject dataHolder, @Nonnull final Patient patient, @Nonnull final PatientData<Feature> features, @Nonnull final PatientWritePolicy policy, @Nonnull final XWikiContext context) { final Stream<Feature> featureStream = PatientWritePolicy.MERGE.equals(policy) ? buildFeaturesStream(load(patient), features) : StreamSupport.stream(features.spliterator(), false); clearFeatureData(docX, dataHolder, context); featureStream .map(feature -> saveFeatureData(docX, feature, context)) .collect(Collectors.groupingBy(this::getFeatureType, Collectors.mapping(Feature::getValue, Collectors.toList())) ).forEach( (type, ids) -> dataHolder.set(type, ids, context) ); }

Target:
private void saveFeatures( @Nonnull final XWikiDocument docX, @Nonnull final BaseObject dataHolder, @Nonnull final Patient patient, @Nonnull final PatientData<Feature> features, @Nonnull final PatientWritePolicy policy, @Nonnull final XWikiContext context) { final Stream<Feature> featureStream = PatientWritePolicy.MERGE.equals(policy) ? buildFeaturesStream(load(patient), features) : StreamSupport.stream(features.spliterator(), false); clearFeatureData(docX, dataHolder, context); featureStream .collect(Collectors.groupingBy(this::getFeatureType, Collectors.mapping(feature -> saveFeatureAndGetValue(docX, feature, context), Collectors.toList())) ).forEach( (type, ids) -> dataHolder.set(type, ids, context) ); }
Source:
public void getRefundedAmount_shouldIncludeCreatedSubmittedAndRefundedRefunds() { RefundEntity refund1 = RefundEntityFixture.aValidRefundEntity().withAmount(10L).withStatus(RefundStatus.CREATED).build(); RefundEntity refund2 = RefundEntityFixture.aValidRefundEntity().withAmount(20L).withStatus(RefundStatus.REFUND_SUBMITTED).build(); RefundEntity refund3 = RefundEntityFixture.aValidRefundEntity().withAmount(30L).withStatus(RefundStatus.REFUNDED).build(); RefundEntity refund4 = RefundEntityFixture.aValidRefundEntity().withAmount(30L).withStatus(RefundStatus.REFUND_ERROR).build(); ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity() .withRefunds(Arrays.asList(refund1, refund2, refund3, refund4)) .build(); long actualAmount = RefundCalculator.getRefundedAmount(chargeEntity); long expectedAmount = refund1.getAmount() + refund2.getAmount() + refund3.getAmount(); assertThat(actualAmount, is(expectedAmount)); }

Target:
public void getRefundedAmount_shouldIncludeCreatedSubmittedAndRefundedRefunds() { RefundEntity createdRefund = RefundEntityFixture.aValidRefundEntity().withAmount(10L).withStatus(RefundStatus.CREATED).build(); RefundEntity submittedRefund = RefundEntityFixture.aValidRefundEntity().withAmount(20L).withStatus(RefundStatus.REFUND_SUBMITTED).build(); RefundEntity refundedRefund = RefundEntityFixture.aValidRefundEntity().withAmount(30L).withStatus(RefundStatus.REFUNDED).build(); RefundEntity errorRefund = RefundEntityFixture.aValidRefundEntity().withAmount(30L).withStatus(RefundStatus.REFUND_ERROR).build(); ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity() .withRefunds(Arrays.asList(createdRefund, submittedRefund, refundedRefund, errorRefund)) .build(); long actualAmount = RefundCalculator.getRefundedAmount(chargeEntity); long expectedAmount = createdRefund.getAmount() + submittedRefund.getAmount() + refundedRefund.getAmount(); assertThat(actualAmount, is(expectedAmount)); }
Source:
public boolean popAndRedirectMessage(String processorName, String storeName) throws Exception { try { return stub.popAndRedirectMessage(processorName, storeName); } catch (Exception e) { handleException(e); return false; } }

Target:
public boolean popAndRedirectMessage(String processorName, String storeName) throws Exception { try { return stub.popAndRedirectMessage(processorName, storeName); } catch (Exception e) { throw createException("Failed to redirect message to " + storeName, e); } }
Source:
private static void writePart(OutputStream out, Map.Entry<String, TypedOutput> part) throws IOException { String name = part.getKey(); TypedOutput value = part.getValue(); out.write("Content-Disposition: form-data; name=\"".getBytes("UTF-8")); out.write(name.getBytes("UTF-8")); out.write('"'); out.write('\r'); out.write('\n'); out.write("Content-Type: ".getBytes("UTF-8")); out.write(value.mimeType().getBytes("UTF-8")); out.write('\r'); out.write('\n'); out.write("Content-Transfer-Encoding: binary".getBytes("UTF-8")); out.write('\r'); out.write('\n'); out.write('\r'); out.write('\n'); value.writeTo(out); }

Target:
private static void writePart(OutputStream out, Map.Entry<String, TypedOutput> part) throws IOException { String name = part.getKey(); TypedOutput value = part.getValue(); StringBuilder headers = new StringBuilder(); headers.append("Content-Disposition: form-data; name=\""); headers.append(name); if (value instanceof TypedFile) { headers.append("; filename=\""); headers.append(((TypedFile) value).file().getName()); } headers.append("\"\r\nContent-Type: "); headers.append(value.mimeType()); headers.append("\r\nContent-Transfer-Encoding: binary\r\n\r\n"); out.write(headers.toString().getBytes("UTF-8")); value.writeTo(out); }
Source:
private void checkLatestVersion() { try { logger.debug("----- Checking version --------------"); String currentVersion = getCurrentVersion(); String versionResponseJson = fetchArtifactVersion(); String latestArtifactVersion = extractVersion(versionResponseJson); Boolean isLatest = extractIsLatest(versionResponseJson); if (isLatest) { logger.info("You are using the latest version!"); } else { warnVersion(latestArtifactVersion, currentVersion); } logger.debug("----- Checking version: Success -----"); } catch (Exception e) { logger.getTreeLogger().log(DEBUG, "Exception caught", e); logger.debug("----- Checking version: Failure -----"); } }

Target:
private void checkLatestVersion() { try { logger.debug("----- Checking version --------------"); logger.debug("You can disable this check by adding this line to your GWT module:"); logger.debug("<set-configuration-property name=\"verifyNewerVersion\" value=\"false\"/>"); String currentVersion = getCurrentVersion(); String versionResponseJson = fetchArtifactVersion(); String latestArtifactVersion = extractVersion(versionResponseJson); Boolean isLatest = extractIsLatest(versionResponseJson); if (isLatest) { logger.info("You are using the latest version!"); } else { warnVersion(latestArtifactVersion, currentVersion); } logger.debug("----- Checking version: Success -----"); } catch (Exception e) { logger.getTreeLogger().log(DEBUG, "Exception caught", e); logger.debug("----- Checking version: Failure -----"); } }
Source:
public void computationShouldNeverBlockDueToParamValue() throws InterruptedException { service.submit(createBuilder().build()); for (String param : Arrays.asList(PARAM_SCHEMAS, PARAM_XPATHS, PARAM_LANG)) { for (Serializable value : TestCSVProjectionComputation.getValues()) { service.submit(createBuilder().param(param, value).build()); } } assertTrue(service.await(Duration.ofSeconds(10))); }

Target:
public void computationShouldNeverBlockDueToParamValue() throws InterruptedException { service.submit(createBuilder().build()); for (Serializable value : TestCSVProjectionComputation.getValues()) { BulkCommand.Builder builder = createBuilder(); for (String param : Arrays.asList(PARAM_SCHEMAS, PARAM_XPATHS, PARAM_LANG)) { builder.param(param, value); } service.submit(builder.build()); } assertTrue(service.await(Duration.ofSeconds(60))); }
Source:
public void testParsingCombined() { for (DependencyParser parser : parsers) { { DependencyParser.DependencyInfo info = parser.parseDependencies("required:supermod3000@[1.2,)"); assertContainsSameToString(info.requirements, Sets.newHashSet("supermod3000@[1.2,)")); assertTrue(info.dependants.isEmpty()); assertTrue(info.dependencies.isEmpty()); assertTrue(info.softRequirements.isEmpty()); } { String dependencyString = "after:supermod2000@[1.3,);required-before:yetanothermod;softDepMod@[1.0,2.0);required:modW"; DependencyParser.DependencyInfo info = parser.parseDependencies(dependencyString); assertContainsSameToString(info.requirements, Sets.newHashSet("yetanothermod", "modW")); assertContainsSameToString(info.softRequirements, Sets.newHashSet("softDepMod@[1.0,2.0)")); assertContainsSameToString(info.dependencies, Sets.newHashSet("supermod2000@[1.3,)")); assertContainsSameToString(info.dependants, Sets.newHashSet("yetanothermod")); } } }

Target:
public void testParsingCombined() { for (DependencyParser parser : parsers) { String dependencyString = "after:supermod2000@[1.3,);required-before:yetanothermod;required:modw"; DependencyParser.DependencyInfo info = parser.parseDependencies(dependencyString); assertContainsSameToString(info.requirements, Sets.newHashSet("yetanothermod", "modw")); assertContainsSameToString(info.dependencies, Sets.newHashSet("supermod2000@[1.3,)")); assertContainsSameToString(info.dependants, Sets.newHashSet("yetanothermod")); } }
Source:
public static File getFileWithConfirmation(File currentFile, String extension, String description, DialogType type, boolean fixExtension) { File file = currentFile; if(file == null || type == DialogType.SAVEAS) file = FileChooserService.getSelectedFile(extension, description, type, fixExtension); file = FileChooserService.confirmFileSave(file, currentFile); return file; }

Target:
public static File getFileWithConfirmation(File currentFile, String extension, String description, DialogType type, boolean fixExtension) { File file = currentFile; if(file == null || type == DialogType.SAVEAS) file = getSelectedFile(extension, description, type, fixExtension); file = confirmFileSave(file, currentFile); return file; }
Source:
public RsWithHeaders(final Response res, final Iterable<? extends CharSequence> headers) { super( new RsOf( () -> RsWithHeaders.extend(res, headers), res::body ) ); }

Target:
public RsWithHeaders(final Response res, final Iterable<? extends CharSequence> headers) { super( new ResponseOf( () -> RsWithHeaders.extend(res, headers), res::body ) ); }
Source:
public static String getPreferredVideoUrlForDownloading(@NonNull VideoData video) { String preferredVideoUrl = null; final VideoInfo preferredVideoInfo = video.encodedVideos.getPreferredVideoInfoForDownloading(); if (preferredVideoInfo == null || video.onlyOnWeb) { preferredVideoUrl = null; } else if (!videoHasFormat(preferredVideoInfo.url, VIDEO_FORMAT_M3U8)) { preferredVideoUrl = preferredVideoInfo.url; } if (TextUtils.isEmpty(preferredVideoUrl) && !new Config(MainApplication.instance()).isUsingVideoPipeline()) { for (String url : video.allSources) { if (VideoUtil.videoHasFormat(url, AppConstants.VIDEO_FORMAT_MP4)) { preferredVideoUrl = url; } } } return preferredVideoUrl; }

Target:
public static String getPreferredVideoUrlForDownloading(@NonNull VideoData video) { String preferredVideoUrl = null; final VideoInfo preferredVideoInfo = video.encodedVideos.getPreferredVideoInfoForDownloading(); if (preferredVideoInfo != null && !TextUtils.isEmpty(preferredVideoInfo.url) && !video.onlyOnWeb && !videoHasFormat(preferredVideoInfo.url, VIDEO_FORMAT_M3U8)) { return preferredVideoInfo.url; } if (!new Config(MainApplication.instance()).isUsingVideoPipeline()) { for (String url : video.allSources) { if (VideoUtil.videoHasFormat(url, AppConstants.VIDEO_FORMAT_MP4)) { preferredVideoUrl = url; } } } return preferredVideoUrl; }
Source:
File moveTempFile() throws IOException { File parent = filename.getParentFile(); if(parent == null) parent = new File("."); File newTemp = File.createTempFile(filename.getName(), ".new.tmp", parent); if(File.separatorChar == '\\') newTemp.delete(); if(tempFilename.renameTo(newTemp)) return newTemp; System.err.println("Unable to rename temporary file "+tempFilename+" to "+newTemp); throw new IOException("Unable to rename temporary file "+tempFilename+" to "+newTemp); }

Target:
synchronized File moveTempFile() throws IOException { if(movedTempFilename != null) return movedTempFilename; File parent = filename.getParentFile(); if(parent == null) parent = new File("."); File newTemp = File.createTempFile(filename.getName(), UPDATER_BACKUP_SUFFIX+FileUtil.getExtension(filename), parent); if(FileUtil.detectedOS.isWindows) newTemp.delete(); if(tempFilename.renameTo(newTemp)) { movedTempFilename = newTemp; return newTemp; } System.err.println("Unable to rename temporary file "+tempFilename+" to "+newTemp); throw new IOException("Unable to rename temporary file "+tempFilename+" to "+newTemp); }
Source:
public void retryPubsub_handlesEmptyMsg() throws IOException { new RetryPubSub().accept(new PubSubMessage(), null); String logMessage = logHandler.getStoredLogRecords().get(0).getMessage(); assertThat("Not retrying...").isEqualTo(logMessage); }

Target:
public void retryPubsub_handlesEmptyMsg() throws IOException { PubSubMessage pubsubMessage = new PubSubMessage(); pubsubMessage.setData(""); new RetryPubSub().accept(pubsubMessage, null); String logMessage = logHandler.getStoredLogRecords().get(0).getMessage(); assertThat("Not retrying...").isEqualTo(logMessage); }
Source:
public static ServerResolver fromWriteServer(ServerResolver writeServerResolver, String readClusterVip, EurekaClientMetricFactory clientMetricFactory, EurekaRegistryMetricFactory registryMetricFactory) { return new EurekaServerResolverBuilder() .withBootstrapResolver(writeServerResolver) .withReadServerInterest(Interests.forVips(readClusterVip)) .withMetricFactory(clientMetricFactory) .withMetricFactory(registryMetricFactory) .build(); }

Target:
public static ServerResolver fromWriteServer(ServerResolver writeServerResolver, String readClusterVip, EurekaClientMetricFactory clientMetricFactory, EurekaRegistryMetricFactory registryMetricFactory) { return new EurekaServerResolverBuilder() .withBootstrapResolver(writeServerResolver) .withReadServerInterest(Interests.forVips(readClusterVip)) .withClientMetricFactory(clientMetricFactory) .withRegistryMetricFactory(registryMetricFactory) .build(); }
Source:
public RuntimeInfo getRuntimeInfo(SimpleFileIODatasetProperties properties) { try { return new JarRuntimeInfo(new URL(SimpleFileIOComponentFamilyDefinition.MAVEN_DEFAULT_RUNTIME_URI), DependenciesReader.computeDependenciesFilePath(SimpleFileIOComponentFamilyDefinition.MAVEN_GROUP_ID, SimpleFileIOComponentFamilyDefinition.MAVEN_DEFAULT_RUNTIME_ARTIFACT_ID), RUNTIME, false); } catch (MalformedURLException e) { throw new ComponentException(e); } }

Target:
public RuntimeInfo getRuntimeInfo(SimpleFileIODatasetProperties properties) { try { return new JarRuntimeInfo(new URL(SimpleFileIOComponentFamilyDefinition.MAVEN_DEFAULT_RUNTIME_URI), DependenciesReader.computeDependenciesFilePath(SimpleFileIOComponentFamilyDefinition.MAVEN_GROUP_ID, SimpleFileIOComponentFamilyDefinition.MAVEN_DEFAULT_RUNTIME_ARTIFACT_ID), RUNTIME, IS_CLASSLOADER_REUSABLE); } catch (MalformedURLException e) { throw new ComponentException(e); } }
Source:
private TokenResponse processTokens(String clientId, String clientSecret, String deviceCode) { TokenRequest tokenRequest = new TokenRequest(GrantType.DEVICE_CODE); tokenRequest.setAuthUsername(clientId); tokenRequest.setAuthPassword(clientSecret);; tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); tokenRequest.setDeviceCode(deviceCode); TokenClient tokenClient1 = newTokenClient(tokenRequest); tokenClient1.setRequest(tokenRequest); TokenResponse tokenResponse1 = tokenClient1.exec(); showClient(tokenClient1); return tokenResponse1; }

Target:
private TokenResponse processTokens(String clientId, String clientSecret, String deviceCode) { TokenRequest tokenRequest = new TokenRequest(GrantType.DEVICE_CODE); tokenRequest.setAuthUsername(clientId); tokenRequest.setAuthPassword(clientSecret);; tokenRequest.setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); tokenRequest.setDeviceCode(deviceCode); TokenClient tokenClient1 = newTokenClient(tokenRequest); TokenResponse tokenResponse1 = tokenClient1.exec(); showClient(tokenClient1); return tokenResponse1; }
Source:
public void testComputeLabelsForOsRelease() throws Exception { PlatformDetailsTask details = new PlatformDetailsTask(); URL resource = getClass().getResource(lsbReleaseFileName); File lsbReleaseFile = new File(resource.toURI()); assertTrue("File not found " + lsbReleaseFile, lsbReleaseFile.exists()); LsbRelease release = new LsbRelease(lsbReleaseFile); PlatformDetails result = details.computeLabels("amd64", "linux", "xyzzy-abc", release); assertThat(result.getArchitecture(), equalTo(expectedArch)); assertThat(result.getName(), equalTo(expectedName)); assertThat(result.getVersion(), equalTo(expectedVersion)); assertThat(result.getArchitectureName(), equalTo(expectedArch + "-" + expectedName)); assertThat( result.getArchitectureNameVersion(), equalTo(expectedArch + "-" + expectedName + "-" + expectedVersion)); assertThat(result.getNameVersion(), equalTo(expectedName + "-" + expectedVersion)); }

Target:
public void testComputeLabelsForOsRelease() throws Exception { PlatformDetailsTask details = new PlatformDetailsTask(); URL resource = getClass().getResource(lsbReleaseFileName); File lsbReleaseFile = new File(resource.toURI()); assertTrue("File not found " + lsbReleaseFile, lsbReleaseFile.exists()); LsbRelease release = new LsbRelease(lsbReleaseFile); PlatformDetails result = details.computeLabels("amd64", "linux", "xyzzy-abc", release); assertThat(result.getArchitecture(), is(expectedArch)); assertThat(result.getName(), is(expectedName)); assertThat(result.getArchitectureName(), is(expectedArch + "-" + expectedName)); assertThat( result.getArchitectureNameVersion(), is(expectedArch + "-" + expectedName + "-" + expectedVersion)); assertThat(result.getNameVersion(), is(expectedName + "-" + expectedVersion)); }
Source:
public void checkName(String origName) throws Failure { if (StringUtils.isNotBlank(DEFAULT_PATTERN) && StringUtils.isNotBlank(origName)) { if (!Pattern.matches(DEFAULT_PATTERN, origName)) { throw new Failure(Messages.Hudson_JobSinglesQuotesAreProhibited()); } } }

Target:
public void checkName(String origName) throws Failure { }
Source:
public void getHTable(String table) throws IOException { final TableName tName = TableName.valueOf(table); synchronized (TABLE_LOCK) { this.currentTable = connection.getTable(tName); if (clientSideBuffering) { final BufferedMutatorParams p = new BufferedMutatorParams(tName); p.writeBufferSize(writeBufferSize); this.bufferedMutator = connection.getBufferedMutator(p); } } }

Target:
public void getHTable(String table) throws IOException { final TableName tName = TableName.valueOf(table); this.currentTable = connection.getTable(tName); if (clientSideBuffering) { final BufferedMutatorParams p = new BufferedMutatorParams(tName); p.writeBufferSize(writeBufferSize); this.bufferedMutator = connection.getBufferedMutator(p); } }
Source:
private MarshallableEntry<K, V> _load(Object key, boolean loadValue, boolean loadMetadata) { final FileEntry fe; resizeLock.readLock().lock(); try { synchronized (entries) { fe = entries.get(key); if (fe == null) return null; if (fe.isExpired(timeService.wallClockTime())) { return null; } else { fe.lock(); } } } finally { resizeLock.readLock().unlock(); } org.infinispan.commons.io.ByteBuffer valueBb = null; org.infinispan.commons.io.ByteBuffer metadataBb = null; if (!loadValue && !loadMetadata) { try { return entryFactory.create(key); } finally { fe.unlock(); } } final byte[] data; try { data = new byte[fe.keyLen + fe.dataLen + (loadMetadata ? fe.metadataLen : 0)]; channel.read(ByteBuffer.wrap(data), fe.offset + KEY_POS); } catch (Exception e) { throw new PersistenceException(e); } finally { fe.unlock(); } if (trace) log.tracef("Read entry %s at %d:%d", key, fe.offset, fe.actualSize()); ByteBufferFactory factory = ctx.getByteBufferFactory(); org.infinispan.commons.io.ByteBuffer keyBb = factory.newByteBuffer(data, 0, fe.keyLen); if (loadValue) { valueBb = factory.newByteBuffer(data, fe.keyLen, fe.dataLen); } if (loadMetadata && fe.metadataLen > 0) { metadataBb = factory.newByteBuffer(data, fe.keyLen + fe.dataLen, fe.metadataLen); } return entryFactory.create(keyBb, valueBb, metadataBb, fe.expiryTime, fe.lastUsed); }

Target:
private MarshallableEntry<K, V> _load(Object key, boolean loadValue, boolean loadMetadata) { final FileEntry fe; resizeLock.readLock().lock(); try { synchronized (entries) { fe = entries.get(key); if (fe == null) return null; if (fe.isExpired(timeService.wallClockTime())) { return null; } else { fe.lock(); } } } finally { resizeLock.readLock().unlock(); } org.infinispan.commons.io.ByteBuffer valueBb = null; org.infinispan.commons.io.ByteBuffer metadataBb = null; if (!loadValue && !loadMetadata) { try { return entryFactory.create(key); } finally { fe.unlock(); } } final byte[] data; try { data = new byte[fe.keyLen + fe.dataLen + (loadMetadata ? fe.metadataLen : 0)]; channel.read(ByteBuffer.wrap(data), fe.offset + KEY_POS); } catch (Exception e) { throw new PersistenceException(e); } finally { fe.unlock(); } if (trace) log.tracef("Read entry %s at %d:%d", key, fe.offset, fe.actualSize()); ByteBufferFactory factory = ctx.getByteBufferFactory(); org.infinispan.commons.io.ByteBuffer keyBb = factory.newByteBuffer(data, 0, fe.keyLen); if (loadValue) { valueBb = factory.newByteBuffer(data, fe.keyLen, fe.dataLen); } if (loadMetadata && fe.metadataLen > 0) { int metaLength = fe.metadataLen - TIMESTAMP_BYTES; metadataBb = factory.newByteBuffer(data, fe.keyLen + fe.dataLen, metaLength); ByteBuffer buffer = ByteBuffer.wrap(data, fe.keyLen + fe.dataLen + metaLength, TIMESTAMP_BYTES); long created = fe.expiryTime > 0 ? buffer.getLong() : -1; long lastUsed = fe.expiryTime > 0 ? buffer.getLong() : -1; return entryFactory.create(keyBb, valueBb, metadataBb, created, lastUsed); } return entryFactory.create(keyBb, valueBb); }
Source:
public FilterDescriptor getFilterDescriptorByKey(final String filterKey) { final FilterDescriptor defaultFilter = this.loadedFilters.values().stream().filter(filterDescriptor -> filterDescriptor.isDefaultFilter()).findAny().get(); if(!UtilMethods.isSet(filterKey)){ return defaultFilter; } return this.loadedFilters.getOrDefault(filterKey,defaultFilter); }

Target:
public FilterDescriptor getFilterDescriptorByKey(final String filterKey) { final FilterDescriptor defaultFilter = getDefaultFilter(); return !UtilMethods.isSet(filterKey) ? defaultFilter : this.loadedFilters.getOrDefault(filterKey,defaultFilter); }
Source:
public static String formatStopDistance(float distance) { int distanceSmoots = (int) (distance * TourUtils.METERS_TO_SMOOTS); float distanceMiles = distance * TourUtils.METERS_TO_MILES; String milesString = String.valueOf(distanceMiles).substring(0, 3); return distanceSmoots + " miles (" + milesString + " smoots) "; }

Target:
public static String formatStopDistance(float distance) { int distanceSmoots = (int) (distance * TourUtils.METERS_TO_SMOOTS); float distanceMiles = distance * TourUtils.METERS_TO_MILES; String milesString = String.valueOf(distanceMiles).substring(0, 3); return milesString + " miles (" + distanceSmoots + " smoots) "; }
Source:
private DataBuffer readChunk() throws IOException { Preconditions.checkState(!mClient.get().isShutdown(), "Data reader is closed while reading data chunks."); DataBuffer buffer = null; ReadResponse response = null; response = mStream.receive(mDataTimeoutMs); if (response != null) { Preconditions.checkState(response.hasChunk() && response.getChunk().hasData(), "response should always contain chunk"); ByteBuffer byteBuffer = response.getChunk().getData().asReadOnlyByteBuffer(); buffer = new NioDataBuffer(byteBuffer, byteBuffer.remaining()); } else { return null; } mPosToRead += buffer.readableBytes(); try { mStream.send(mReadRequest.toBuilder().setOffsetReceived(mPosToRead).build()); } catch (Exception e) { LOG.debug("Failed to send receipt of data to worker for request {}: {}.", mAddress, mReadRequest, e.getMessage()); } Preconditions.checkState(mPosToRead - mReadRequest.getOffset() <= mReadRequest.getLength()); return buffer; }

Target:
private DataBuffer readChunk() throws IOException { Preconditions.checkState(!mClient.get().isShutdown(), "Data reader is closed while reading data chunks."); DataBuffer buffer = null; ReadResponse response = null; response = mStream.receive(mDataTimeoutMs); if (response == null) { return null; } Preconditions.checkState(response.hasChunk() && response.getChunk().hasData(), "response should always contain chunk"); ByteBuffer byteBuffer = response.getChunk().getData().asReadOnlyByteBuffer(); buffer = new NioDataBuffer(byteBuffer, byteBuffer.remaining()); mPosToRead += buffer.readableBytes(); try { mStream.send(mReadRequest.toBuilder().setOffsetReceived(mPosToRead).build()); } catch (Exception e) { LOG.debug("Failed to send receipt of data to worker for request {}: {}.", mAddress, mReadRequest, e.getMessage()); } Preconditions.checkState(mPosToRead - mReadRequest.getOffset() <= mReadRequest.getLength()); return buffer; }
Source:
public void cancelUpdateProfile() { doAIA(); loginPage.login("test-user@localhost", "password"); updateProfilePage.assertCurrent(); updateProfilePage.cancel(); assertRedirectSuccess(); appPage.logout(); loginPage.open(); loginPage.assertCurrent(); loginPage.login("test-user@localhost", "password"); updateProfilePage.assertCurrent(); }

Target:
public void cancelUpdateProfile() { doAIA(); loginPage.login("test-user@localhost", "password"); updateProfilePage.assertCurrent(); updateProfilePage.cancel(); assertRedirectSuccess(); assertCancelMessage(); appPage.logout(); loginPage.open(); loginPage.assertCurrent(); loginPage.login("test-user@localhost", "password"); updateProfilePage.assertCurrent(); }
Source:
private ILaunch attachRemoteDebugger(IServer server, int localDebugPort, IProgressMonitor monitor) throws CoreException { monitor.subTask("Attaching remote debugger..."); ILaunch ret = null; DebugLaunchConfigs launchConfigs = DebugLaunchConfigs.get(); if( launchConfigs == null ) { throw toCoreException(NLS.bind("Could not modify launch config for server {0}", server.getName())); } ILaunchConfiguration debuggerLaunchConfig = launchConfigs.getRemoteDebuggerLaunchConfiguration(server); ILaunchConfigurationWorkingCopy workingCopy = getLaunchConfigWorkingCopy(server, launchConfigs, debuggerLaunchConfig); if (workingCopy == null) { throw toCoreException(NLS.bind("Could not modify launch config for server {0}", server.getName())); } IProject project = OpenShiftServerUtils.getDeployProject(server); launchConfigs.setupRemoteDebuggerLaunchConfiguration(workingCopy, project, localDebugPort); debuggerLaunchConfig = workingCopy.doSave(); ret = lauchDebugger(debuggerLaunchConfig, localDebugPort, monitor); if (ret == null) { throw toCoreException( NLS.bind("Could not start remote debugger to (forwarded) port {0} on localhost", localDebugPort)); } monitor.worked(10); return ret; }

Target:
private ILaunch attachRemoteDebugger(IServer server, int localDebugPort, IProgressMonitor monitor) throws CoreException { monitor.subTask("Attaching remote debugger..."); ILaunch ret = null; DebugLaunchConfigs launchConfigs = DebugLaunchConfigs.get(); if( launchConfigs == null ) { throw toCoreException(NLS.bind("Could not get launch config for server {0} to attach remote debugger", server.getName())); } ILaunchConfiguration debuggerLaunchConfig = launchConfigs.getRemoteDebuggerLaunchConfiguration(server); ILaunchConfigurationWorkingCopy workingCopy = getLaunchConfigWorkingCopy(server, launchConfigs, debuggerLaunchConfig); if (workingCopy == null) { throw toCoreException(NLS.bind("Could not modify launch config for server {0}", server.getName())); } IProject project = OpenShiftServerUtils.getDeployProject(server); launchConfigs.setupRemoteDebuggerLaunchConfiguration(workingCopy, project, localDebugPort); debuggerLaunchConfig = workingCopy.doSave(); ret = lauchDebugger(debuggerLaunchConfig, localDebugPort, monitor); if (ret == null) { throw toCoreException( NLS.bind("Could not start remote debugger to (forwarded) port {0} on localhost", localDebugPort)); } monitor.worked(10); return ret; }
Source:
default public State as(Class<? extends State> target) { if (target != null && target.isInstance(this)) { return this; } else { return null; } }

Target:
default State as(Class<? extends State> target) { if (target != null && target.isInstance(this)) { return this; } else { return null; } }
Source:
public boolean finishInErrorTask(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException { final JobId jobIdObject = JobIdImpl.makeJobId(jobId); frontendState.checkJobOwner("finishTaskInError", frontendState.getIdentifiedJob(jobIdObject), "You do not have permission to finish this task!"); return schedulingService.finishInErrorTask(jobIdObject, taskName); }

Target:
public boolean finishInErrorTask(String jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException { final JobId jobIdObject = JobIdImpl.makeJobId(jobId); frontendState.checkJobOwner("finishTaskInError", frontendState.getIdentifiedJob(jobIdObject), "You do not have permission to finish this task!"); frontendState.checkPermissions("finishTaskInError", frontendState.getIdentifiedJob(jobIdObject), YOU_DO_NOT_HAVE_PERMISSION_TO_FINISH_THIS_TASK); return schedulingService.finishInErrorTask(jobIdObject, taskName); }
Source:
public String attemptRequest() throws RemoteServiceException { evaluateState(); if (state == State.OPEN) { return "This is stale response from API"; } else { try { var response = service.call(); recordSuccess(); return response; } catch (RemoteServiceException ex) { recordFailure(); throw ex; } } }

Target:
public String attemptRequest() throws RemoteServiceException { evaluateState(); if (state == State.OPEN) { return this.lastFailureResponse; } else { try { var response = service.call(); recordSuccess(); return response; } catch (RemoteServiceException ex) { recordFailure(ex.getMessage()); throw ex; } } }
Source:
public void writeContent(Content content) { if (content instanceof Brand) { contentWriter.createOrUpdate((Brand) content); } else if (content instanceof Series) { contentWriter.createOrUpdate((Series) content); } else if (content instanceof Episode) { contentWriter.createOrUpdate((Episode) content); } else if (content instanceof Film) { contentWriter.createOrUpdate((Film) content); } else if (content instanceof Item) { contentWriter.createOrUpdate((Item) content); } }

Target:
public void writeContent(Content content) { if (content instanceof Brand) { contentWriter.createOrUpdate((Brand) content); } else if (content instanceof Series) { contentWriter.createOrUpdate((Series) content); } else if (content instanceof Episode) { contentWriter.createOrUpdate((Episode) content); } else if (content instanceof Film) { contentWriter.createOrUpdate((Film) content); } else if (content instanceof Item) { contentWriter.createOrUpdate((Item) content); } else { throw new RuntimeException("Unexpected instance type: " + content.getClass().getName()); } }
Source:
@Override protected void afterTest() { stopAllGrids(); }

Target:
@Override protected void afterTest() throws Exception { stopAllGrids(); super.afterTest(); }