auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testFreestyleWithExceptionPublisher() throws IOException, ExecutionException, InterruptedException { FreeStyleProject p = j.createFreeStyleProject(); p.getPublishersList().add(new TrueFalsePublisher(true)); p.getPublishersList().add(new AbortExceptionPublisher()); p.getPublishersList().add(new ResultWriterPublisher("result.txt")); p.getPublishersList().add(new ArtifactArchiver("result.txt", "", false)); FreeStyleBuild b = p.scheduleBuild2(0).get(); assertEquals("Build must fail, because we used FalsePublisher", b.getResult(), Result.FAILURE); File file = new File(b.getArtifactsDir(), "result.txt"); assertTrue("ArtifactArchiver is executed even prior publisher fails.", file.exists()); assertTrue("Second publisher must see FAILURE status", FileUtils.readFileToString(file).equals(Result.FAILURE.toString())); }

Target:
public void testFreestyleWithExceptionPublisher() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.getPublishersList().add(new TrueFalsePublisher(true)); p.getPublishersList().add(new AbortExceptionPublisher()); p.getPublishersList().add(new ResultWriterPublisher("result.txt")); final ArtifactArchiver artifactArchiver = new ArtifactArchiver("result.txt"); artifactArchiver.setOnlyIfSuccessful(false); p.getPublishersList().add(artifactArchiver); FreeStyleBuild b = p.scheduleBuild2(0).get(); assertEquals("Build must fail, because we used AbortExceptionPublisher", b.getResult(), Result.FAILURE); j.assertLogNotContains("\tat", b); j.assertLogContains("Threw AbortException from publisher!", b); File file = new File(b.getArtifactsDir(), "result.txt"); assertTrue("ArtifactArchiver is executed even prior publisher fails", file.exists()); assertTrue("Third publisher must see FAILURE status", FileUtils.readFileToString(file).equals(Result.FAILURE.toString())); }
Source:
public void testWriteJobWithZeroLengthObject() throws Exception { final Ds3Client client = Ds3ClientBuilder.fromEnv() .withHttps(false) .build(); final Path tempDirectory = Files.createTempDirectory(Paths.get("."), null); final Path tempFile = Files.createTempFile(tempDirectory, "EmptyFile", null); final String fileName = tempFile.getFileName().toString(); try { final Ds3ClientHelpers ds3ClientHelpers = Ds3ClientHelpers.wrap(client); final ImmutableList<Ds3Object> objects = ImmutableList.of(new Ds3Object(fileName, 0)); final Ds3ClientHelpers.Job writeJob = ds3ClientHelpers.startWriteJob(BUCKET_NAME, objects); writeJob.transfer(new FileObjectPutter(tempDirectory)); final GetBucketResponse request = client.getBucket(new GetBucketRequest(BUCKET_NAME)); final ListBucketResult result = request.getListBucketResult(); assertThat(result.getObjects().size(), is(1)); final Contents contents = result.getObjects().get(0); assertThat(contents.getKey(), is(fileName)); assertThat(contents.getSize(), is((long) 0)); } finally { FileUtils.deleteDirectory(tempDirectory.toFile()); deleteAllContents(client, BUCKET_NAME); } }

Target:
public void testWriteJobWithZeroLengthObject() throws Exception { final Path tempDirectory = Files.createTempDirectory(Paths.get("."), null); final Path tempFile = Files.createTempFile(tempDirectory, "EmptyFile", null); final String fileName = tempFile.getFileName().toString(); try { final Ds3ClientHelpers ds3ClientHelpers = Ds3ClientHelpers.wrap(client); final ImmutableList<Ds3Object> objects = ImmutableList.of(new Ds3Object(fileName, 0)); final Ds3ClientHelpers.Job writeJob = ds3ClientHelpers.startWriteJob(BUCKET_NAME, objects); writeJob.transfer(new FileObjectPutter(tempDirectory)); final GetBucketResponse request = client.getBucket(new GetBucketRequest(BUCKET_NAME)); final ListBucketResult result = request.getListBucketResult(); assertThat(result.getObjects().size(), is(1)); final Contents contents = result.getObjects().get(0); assertThat(contents.getKey(), is(fileName)); assertThat(contents.getSize(), is((long) 0)); } finally { FileUtils.deleteDirectory(tempDirectory.toFile()); deleteAllContents(client, BUCKET_NAME); } }
Source:
public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("The input geometry should not be empty")); } OGCGeometry convexHull = geometry.convexHull(); if (!isGeometrySimple(convexHull)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Unable to construct a convex hull based on input")); } return serialize(convexHull); }

Target:
public static Slice stConvexHull(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_ConvexHull", geometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); if (geometry.isEmpty()) { return input; } if (GeometryType.getForEsriGeometryType(geometry.geometryType()) == POINT) { return input; } OGCGeometry convexHull = geometry.convexHull(); if (convexHull.isEmpty()) { return serialize(createFromEsriGeometry(((MultiVertexGeometry) geometry.getEsriGeometry()).getPoint(0), null)); } if (GeometryType.getForEsriGeometryType(convexHull.geometryType()) == MULTI_POLYGON) { MultiVertexGeometry multiVertex = (MultiVertexGeometry) convexHull.getEsriGeometry(); if (multiVertex.getPointCount() == 2) { OGCGeometry linestring = createFromEsriGeometry(new Polyline(multiVertex.getPoint(0), multiVertex.getPoint(1)), null); return serialize(linestring); } } return serialize(convexHull); }
Source:
public void shutdownServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); managementClient.executeForResult(Operations.createOperation(SHUTDOWN, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { ex.printStackTrace(); break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Assert.assertFalse(controller.getClient().isServerInRunningState()); } Assert.assertFalse(controller.getClient().isServerInRunningState()); try { controller.stop(); } catch (RuntimeException ex) { } controller.start(); }

Target:
public void shutdownServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); managementClient.executeForResult(Operations.createOperation(SHUTDOWN, new ModelNode().setEmptyList())); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { controller.getClient().isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); Assert.assertFalse(controller.getClient().isServerInRunningState()); } Assert.assertFalse(controller.getClient().isServerInRunningState()); try { controller.stop(); } catch (RuntimeException ex) { } controller.start(); }
Source:
public synchronized void start() throws Exception { LOG.info("Try to start Directory Polling Service..."); if (running) { throw new IllegalStateException("Monitor is already running"); } running = true; thread = new Thread(this); thread.start(); LOG.info("Successfully start of Directory Polling Service."); }

Target:
public synchronized void start() throws Exception { LOG.info("Try to start Directory Polling Service..."); running = true; thread = new Thread(this); thread.start(); LOG.info("Successfully start of Directory Polling Service."); }
Source:
private String getBambooBaseUrl() { return getAdministrationConfiguration().getBaseUrl(); }

Target:
private String getBambooBaseUrl() { if (this.adminConfiguration != null) { return StringUtils.isNoneBlank(this.adminConfiguration.getBaseUrl()) ? this.adminConfiguration.getBaseUrl() : ""; } return ""; }
Source:
public void loadApps() { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); this.view.setOnRetryButtonClicked(event -> { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); }); this.view.setOnSelectCategory(categoryDTO -> this.view.populateApps( new ArrayList<ApplicationDTO>(categoryDTO.getApplications().values()))); this.view.setOnSelectScript(scriptDTO -> scriptInterpreter.runScript( scriptDTO.getScript(), e -> Platform.runLater(() -> new ErrorMessage("The script ended unexpectedly", e)) )); onAppLoaded.run(); }

Target:
public void loadApps() { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); this.view.setOnRetryButtonClicked(event -> { this.view.showWait(); appsSource.fetchInstallableApplications( this.view::populate, e -> this.view.showFailure() ); }); this.view.setOnSelectCategory(categoryDTO -> this.view.populateApps( new ArrayList<>(categoryDTO.getApplications().values()))); this.view.setOnSelectScript(scriptDTO -> scriptInterpreter.runScript( scriptDTO.getScript(), e -> Platform.runLater(() -> new ErrorMessage("The script ended unexpectedly", e)) )); onAppLoaded.run(); }
Source:
public void waitForNodesToShutdown() { if (m_cluster != null) { for (Process proc : m_cluster) { if (proc == null) continue; int retval = 0; try { retval = proc.waitFor(); } catch (InterruptedException e) { log.error("Unable to wait for Localcluster process to die: " + proc.toString(), e); } if (retval != 0 && retval != 143) { log.error("External VoltDB process terminated abnormally with return: " + retval); } } } if (m_cluster != null) m_cluster.clear(); for (EEProcess proc : m_eeProcs) { File valgrindOutputFile = null; try { valgrindOutputFile = proc.waitForShutdown(); } catch (InterruptedException e) { log.error("Unable to wait for EEProcess to die: " + proc.toString(), e); } failIfValgrindErrors(valgrindOutputFile); } if (templateCmdLine.target() == BackendTarget.NATIVE_EE_VALGRIND_IPC) { if (!EEProcess.m_valgrindErrors.isEmpty()) { StringBuilder failString = new StringBuilder(); final Iterator<String> iter = EEProcess.m_valgrindErrors.iterator(); while (iter.hasNext()) { failString.append("\n" + iter.next()); } org.junit.Assert.fail(failString.toString()); } } m_eeProcs.clear(); m_running = false; }

Target:
public void waitForNodesToShutdown() { if (m_cluster != null) { for (Process proc : m_cluster) { if (proc == null) continue; int retval = 0; try { retval = proc.waitFor(); } catch (InterruptedException e) { log.error("Unable to wait for Localcluster process to die: " + proc.toString(), e); } if (retval != 0 && retval != 143) { log.error("External VoltDB process terminated abnormally with return: " + retval); } } } if (m_cluster != null) m_cluster.clear(); for (EEProcess proc : m_eeProcs) { File valgrindOutputFile = null; try { valgrindOutputFile = proc.waitForShutdown(); } catch (InterruptedException e) { log.error("Unable to wait for EEProcess to die: " + proc.toString(), e); } failIfValgrindErrors(valgrindOutputFile); } m_eeProcs.clear(); m_running = false; }
Source:
public String toString() { final StringBuffer sb = new StringBuffer("BulkheadConfig{"); sb.append("maxConcurrentCalls=").append(maxConcurrentCalls); sb.append(", maxWaitDuration=").append(maxWaitDuration); sb.append(", writableStackTraceEnabled=").append(writableStackTraceEnabled); sb.append(", fairCallHandlingEnabled=").append(fairCallHandlingEnabled); sb.append('}'); return sb.toString(); }

Target:
public String toString() { final StringBuilder sb = new StringBuilder("BulkheadConfig{"); sb.append("maxConcurrentCalls=").append(maxConcurrentCalls); sb.append(", maxWaitDuration=").append(maxWaitDuration); sb.append(", writableStackTraceEnabled=").append(writableStackTraceEnabled); sb.append(", fairCallHandlingEnabled=").append(fairCallHandlingEnabled); sb.append('}'); return sb.toString(); }
Source:
public void onUpdate(String instanceId, JsonObject data) { ThingUID bridge = handler.getThing().getUID(); try { if (data.has(INSTANCE_ID)) { int id = data.get(INSTANCE_ID).getAsInt(); String type = data.get(TYPE).getAsString(); ThingUID thingId = null; if (type.equals(TYPE_LIGHT) && data.has(LIGHT)) { JsonObject state = data.get(LIGHT).getAsJsonArray().get(0).getAsJsonObject(); if (state.has(COLOR)) { thingId = new ThingUID(THING_TYPE_COLOR_TEMP_LIGHT, bridge, Integer.toString(id)); } else { thingId = new ThingUID(THING_TYPE_DIMMABLE_LIGHT, bridge, Integer.toString(id)); } } if (thingId == null) { return; } String label = "Unknown device"; try { label = data.get(NAME).getAsString(); } catch (JsonSyntaxException e) { logger.error("JSON error: {}", e.getMessage()); } Map<String, Object> properties = new HashMap<>(1); properties.put("id", id); logger.debug("Adding device to inbox", thingId); DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingId).withBridge(bridge) .withLabel(label).withProperties(properties).withRepresentationProperty("id").build(); thingDiscovered(discoveryResult); } } catch (JsonSyntaxException e) { logger.error("JSON error: {}", e.getMessage()); } }

Target:
public void onUpdate(String instanceId, JsonObject data) { ThingUID bridge = handler.getThing().getUID(); try { if (data.has(INSTANCE_ID)) { int id = data.get(INSTANCE_ID).getAsInt(); String type = data.get(TYPE).getAsString(); JsonObject deviceInfo = data.get(DEVICE).getAsJsonObject(); String model = deviceInfo.get(DEVICE_MODEL).getAsString(); ThingUID thingId = null; if (type.equals(TYPE_LIGHT) && data.has(LIGHT)) { JsonObject state = data.get(LIGHT).getAsJsonArray().get(0).getAsJsonObject(); if (state.has(COLOR) || (model != null && Arrays.asList(COLOR_TEMP_MODELS).contains(model))) { thingId = new ThingUID(THING_TYPE_COLOR_TEMP_LIGHT, bridge, Integer.toString(id)); } else { thingId = new ThingUID(THING_TYPE_DIMMABLE_LIGHT, bridge, Integer.toString(id)); } } if (thingId == null) { return; } String label = data.get(NAME).getAsString(); Map<String, Object> properties = new HashMap<>(1); properties.put("id", id); if (deviceInfo.get(DEVICE_VENDOR) != null) { properties.put("vendor", deviceInfo.get(DEVICE_VENDOR)); } logger.debug("Adding device to inbox", thingId); DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingId).withBridge(bridge) .withLabel(label).withProperties(properties).withRepresentationProperty("id").build(); thingDiscovered(discoveryResult); } } catch (JsonSyntaxException e) { logger.debug("JSON error during discovery: {}", e.getMessage()); } }
Source:
public void testFormatStringForBubbleBricks() { String testFirstCharWhitespace = " abcdefabcdefabcdefabcdef abcdef abcdefabcdefabcdef"; String[] expectedResult = {"abcdefabcdefabcd", "efabcdef abcdef", "abcdefabcdefabcd", "ef"}; List<String> expectedResultList = Arrays.asList(expectedResult); List<String> resultList = Utils.formatStringForBubbleBricks(testFirstCharWhitespace); assertNotNull(resultList); assertEquals(expectedResultList, resultList); }

Target:
public void testFormatStringForBubbleBricks() { String testFirstCharWhitespace = " ThisIsAReallyLongishWord toTest TheWordWrapperFunc"; String[] expectedResult = {"ThisIsAReallyLon", "gishWord toTest", "TheWordWrapperFu", "nc"}; List<String> expectedResultList = Arrays.asList(expectedResult); List<String> resultList = ShowBubbleActor.formatStringForBubbleBricks(testFirstCharWhitespace); assertNotNull(resultList); assertEquals(expectedResultList, resultList); }
Source:
public abstract void write(@Nonnull OutputVFS outputVDir) throws DexWritingException; protected void finishMerge(@Nonnull JackMerger merger, @Nonnull OutputVFile out) throws DexWritingException { OutputStream os = null; try { try { os = new BufferedOutputStream(out.getOutputStream()); merger.finish(os); } finally { if (os != null) { os.close(); } } } catch (WrongPermissionException e) { throw new DexWritingException(e); } catch (IOException e) { throw new DexWritingException(e); } }

Target:
public abstract void write(@Nonnull OutputVFS outputVDir) throws DexWritingException; protected void finishMerge(@Nonnull JackMerger merger, @Nonnull OutputVFile out) throws DexWritingException { OutputStream os = null; try { try { os = new BufferedOutputStream(out.getOutputStream()); merger.finish(os); } finally { if (os != null) { os.close(); } } } catch (IOException | WrongPermissionException e) { throw new DexWritingException(e); } }
Source:
public void testReadAll() throws Exception { ByteBuffer bb = ByteBuffer.allocate(1024); struct.encoder() .string("name", "joe") .int64s("ids") .value(4L) .value(5L) .value(6L) .end() .string("address", "my street") .strings("colors") .value("blue") .value("green") .end() .int64("age", 30) .encode(bb); bb.rewind(); StructDecoder decoder = struct.decoder(bb); assertThat(decoder.string("name"), is("joe")); ArrayDecoder<Long> adi = decoder.int64s("ids"); assertThat(adi.size(), is(3)); assertThat(adi.value(), is(4L)); assertThat(adi.value(), is(5L)); assertThat(adi.value(), is(6L)); adi.end(); assertThat(decoder.string("address"), is("my street")); ArrayDecoder<String> ads = decoder.strings("colors"); assertThat(ads.size(), is(2)); assertThat(ads.value(), is("blue")); assertThat(ads.value(), is("green")); ads.end(); assertThat(decoder.int64("age"), is(30L)); }

Target:
public void testReadAll() throws Exception { ByteBuffer bb = ByteBuffer.allocate(1024); struct.encoder() .string("name", "joe") .int64s("ids") .value(4L) .value(5L) .value(6L) .end() .string("address", "my street") .strings("colors") .value("blue") .value("green") .end() .int64("age", 30) .encode(bb); bb.rewind(); StructDecoder decoder = struct.decoder(bb); assertThat(decoder.string("name"), is("joe")); ArrayDecoder<Long> adi = decoder.int64s("ids"); assertThat(adi.length(), is(3)); assertThat(adi.value(), is(4L)); assertThat(adi.value(), is(5L)); assertThat(adi.value(), is(6L)); adi.end(); assertThat(decoder.string("address"), is("my street")); ArrayDecoder<String> ads = decoder.strings("colors"); assertThat(ads.length(), is(2)); assertThat(ads.value(), is("blue")); assertThat(ads.value(), is("green")); ads.end(); assertThat(decoder.int64("age"), is(30L)); }
Source:
private void verifyResult(final List<KeyValue<Integer, Integer>> expected) { final ConsumerRecordFactory<Integer, Integer> recordFactory = new ConsumerRecordFactory<>(new IntegerSerializer(), new IntegerSerializer()); final Properties props = StreamsTestUtils.getStreamsConfig(Serdes.Integer(), Serdes.Integer()); try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(), props)) { driver.pipeInput(recordFactory.create(topic, Arrays.asList(new KeyValue<>(1, 1), new KeyValue<>(2, 2), new KeyValue<>(3, 3), new KeyValue<>(2, 1), new KeyValue<>(2, 3), new KeyValue<>(1, 3)))); } assertThat(results, equalTo(expected)); }

Target:
private void verifyResult(final List<KeyValue<Integer, Integer>> expected) { final Properties props = StreamsTestUtils.getStreamsConfig(Serdes.Integer(), Serdes.Integer()); try (final TopologyTestDriver driver = new TopologyTestDriver(builder.build(), props)) { final TestInputTopic<Integer, Integer> inputTopic = driver.createInputTopic(topic, new IntegerSerializer(), new IntegerSerializer()); inputTopic.pipeKeyValueList(Arrays.asList( new KeyValue<>(1, 1), new KeyValue<>(2, 2), new KeyValue<>(3, 3), new KeyValue<>(2, 1), new KeyValue<>(2, 3), new KeyValue<>(1, 3))); } assertThat(results, equalTo(expected)); }
Source:
public Optional<Principal> provide() { final Principal principal = getContainerRequest().getSecurityContext().getUserPrincipal(); if (principal == null) { return Optional.empty(); } else { return Optional.of(principal); } }

Target:
public Optional<Principal> provide() { return Optional.ofNullable(getContainerRequest().getSecurityContext().getUserPrincipal()); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { final Shell shell = HandlerUtil.getActiveShellChecked(event); final SpecfileParser specparser = new SpecfileParser(); final IResource resource = RPMHandlerUtils.getResource(event); final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); final IFile workFile = (IFile) rpj.getSpecFile(); final Specfile specfile = specparser.parse(workFile); if (!DownloadFile(shell, rpj, specfile)) return null; Job job = new Job("Preparing sources") { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask( "Preparing sources for " + rpj.getSpecFile().getName(), IProgressMonitor.UNKNOWN); int offset = rpj.getSpecFile().getName().toString() .lastIndexOf("."); MessageConsoleStream out = getConsole( rpj.getSpecFile().getName().toString() .substring(0, offset)).newMessageStream(); IStatus is = null; try { is = rpj.buildPrep(out); } catch (CoreException e) { SpecfileLog.logError(Messages.PrepareSources_coreException, e); RPMUtils.showErrorDialog(shell, Messages.PrepareSources_error, Messages.PrepareSources_coreException); return is; } finally { monitor.done(); } return is; } }; job.setUser(true); job.schedule(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final Shell shell = HandlerUtil.getActiveShellChecked(event); final SpecfileParser specparser = new SpecfileParser(); final IResource resource = RPMHandlerUtils.getResource(event); final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); final IFile workFile = (IFile) rpj.getSpecFile(); final Specfile specfile = specparser.parse(workFile); if (!DownloadFile(shell, rpj, specfile)) return null; Job job = new Job("Preparing sources") { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask( NLS.bind(Messages.PrepareSources_prepareSources, rpj.getSpecFile().getName()), IProgressMonitor.UNKNOWN); int offset = rpj.getSpecFile().getName().toString() .lastIndexOf("."); MessageConsoleStream out = getConsole( rpj.getSpecFile().getName().toString() .substring(0, offset)).newMessageStream(); IStatus is = null; try { is = rpj.buildPrep(out); } catch (CoreException e) { SpecfileLog.logError(Messages.PrepareSources_coreException, e); RPMUtils.showErrorDialog(shell, Messages.PrepareSources_error, Messages.PrepareSources_coreException); return is; } finally { monitor.done(); } return is; } }; job.setUser(true); job.schedule(); return null; }
Source:
public void handle(EventMessage<?> message, Segment segment) throws Exception { logger.trace("Received event {}. Segment Id {}. Thread {}.", message.getIdentifier(), segment.getSegmentId(), Thread.currentThread().getName()); if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } }

Target:
public void handle(EventMessage<?> message, Segment segment) throws Exception { if (logger.isTraceEnabled()) { logger.trace("Received event {}. Segment Id {}. Thread {}.", message.getIdentifier(), segment.getSegmentId(), Thread.currentThread().getName()); } if (sequencingPolicyMatchesSegment(message, segment)) { for (EventMessageHandler handler : wrappedEventHandlers) { try { handler.handle(message); } catch (Exception e) { listenerInvocationErrorHandler.onError(e, message, handler); } } } }
Source:
private void checkPermissions() { for (String permission : REQUIRED_PERMISSIONS) { if (mContext.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) { continue; } if (Build.VERSION.SDK_INT < 23) { throw new RuntimeException("We need " + permission + " permission for screenshot tests"); } Context targetContext = Registry.getRegistry().instrumentation.getTargetContext(); grantPermission(targetContext, permission); grantPermission(mContext, permission); } }

Target:
private void checkPermissions() { for (String permission : REQUIRED_PERMISSIONS) { if ((permission.equals(READ_PERMISSION) && Build.VERSION.SDK_INT < 16) || mContext.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) { continue; } if (Build.VERSION.SDK_INT < 23) { throw new RuntimeException("We need " + permission + " permission for screenshot tests"); } Context targetContext = Registry.getRegistry().instrumentation.getTargetContext(); grantPermission(targetContext, permission); grantPermission(mContext, permission); } }
Source:
public ListenableFuture<?> isBlocked() { switch (state) { case CONSUMING_INPUT: return NOT_BLOCKED; case SPILLING_INPUT: return spillInProgress; case LOOKUP_SOURCE_BUILT: return lookupSourceNotNeeded.orElseThrow(() -> new IllegalStateException("Lookup source built, but disposal future not set")); case INPUT_SPILLED: return spilledLookupSourceHandle.getUnspillingOrDisposeRequested(); case INPUT_UNSPILLING: return unspillInProgress.orElseThrow(() -> new IllegalStateException("Unspilling in progress, but unspilling future not set")); case INPUT_UNSPILLED_AND_BUILT: return spilledLookupSourceHandle.getDisposeRequested(); case DISPOSED: case CLOSED: return lookupSourceFactoryDestroyed; } throw new IllegalStateException("Unhandled state: " + state); }

Target:
public ListenableFuture<?> isBlocked() { switch (state) { case CONSUMING_INPUT: return NOT_BLOCKED; case SPILLING_INPUT: return spillInProgress; case LOOKUP_SOURCE_BUILT: return lookupSourceNotNeeded.orElseThrow(() -> new IllegalStateException("Lookup source built, but disposal future not set")); case INPUT_SPILLED: return spilledLookupSourceHandle.getUnspillingOrDisposeRequested(); case INPUT_UNSPILLING: return unspillInProgress.orElseThrow(() -> new IllegalStateException("Unspilling in progress, but unspilling future not set")); case INPUT_UNSPILLED_AND_BUILT: return spilledLookupSourceHandle.getDisposeRequested(); case CLOSED: return NOT_BLOCKED; } throw new IllegalStateException("Unhandled state: " + state); }
Source:
public boolean repair(Resource resource, EPackage profileDefinition, Collection<? extends EObject> stereotypeApplications, DiagnosticChain diagnostics, IProgressMonitor monitor) { boolean result = false; Iterator<Profile> profilesIterator = previousProfilesSet.iterator(); while (!result && profilesIterator.hasNext()) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, monitor, profilesIterator.next()); } if (!result) { appliedProfile = profileSupplier.get(); if (appliedProfile != null) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, monitor, appliedProfile); } } return result; }

Target:
public boolean repair(Resource resource, EPackage profileDefinition, Collection<? extends EObject> stereotypeApplications, DiagnosticChain diagnostics, IProgressMonitor monitor) { boolean result = false; SubMonitor repairMonitor = SubMonitor.convert(monitor, 2); if (previousProfile != null) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, repairMonitor.newChild(1, SubMonitor.SUPPRESS_NONE), previousProfile); } if (!result) { appliedProfile = profileSupplier.get(); if (appliedProfile != null) { result = applySelectedProfile(resource, stereotypeApplications, diagnostics, repairMonitor.newChild(1, SubMonitor.SUPPRESS_NONE), appliedProfile); } } repairMonitor.done(); return result; }
Source:
} catch (Exception e) { throw new RuntimeException(e); }

Target:
} catch (Exception e) { throw new TestSetupError("Failed to lookup of field", e); }
Source:
public void testProcessVariable() { Map<String, Object> data = new HashMap<>(); data.put("continue", false); CaseFileInstance caseFile = caseService.newCaseFileInstance(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_PROCESS_VARIABLE, data, Collections.emptyMap()); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_PROCESS_VARIABLE, caseFile); assertThat(caseId).isNotNull().isEqualTo(FIRST_CASE_ID); assertCaseInstanceActive(caseId); CaseInstance caseInstance = caseService.getCaseInstance(caseId); assertThat(caseInstance).isNotNull(); Long processInstanceId = ((CaseInstanceImpl) caseInstance).getProcessInstanceId(); processService.setProcessVariable(processInstanceId, "continue", false); caseService.addDataToCaseFile(caseId, "continue", true); assertCaseInstanceActive(caseId); processService.setProcessVariable(processInstanceId, "continue", true); assertCaseInstanceNotActive(caseId); }

Target:
public void testProcessVariable() { Map<String, Object> data = new HashMap<>(); data.put("continue", false); CaseFileInstance caseFile = caseService.newCaseFileInstance(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_PROCESS_VARIABLE, data, Collections.emptyMap()); String caseId = caseService.startCase(deploymentUnit.getIdentifier(), STAGE_WITH_TASK_PROCESS_VARIABLE, caseFile); assertThat(caseId).isNotNull().isEqualTo(FIRST_CASE_ID); assertCaseInstanceActive(caseId); CaseInstance caseInstance = caseService.getCaseInstance(caseId); assertThat(caseInstance).isNotNull(); Long processInstanceId = ((CaseInstanceImpl) caseInstance).getProcessInstanceId(); processService.setProcessVariable(processInstanceId, "continue", false); caseService.addDataToCaseFile(caseId, "continue", true); List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER, new QueryFilter()); assertThat(tasks).hasSize(1); TaskSummary insideTask = tasks.get(0); assertThat(insideTask.getName()).isEqualTo(INSIDE_TASK); userTaskService.completeAutoProgress(insideTask.getId(), USER, null); assertCaseInstanceActive(caseId); processService.setProcessVariable(processInstanceId, "continue", true); caseInstance = caseService.getCaseInstance(caseId, false, false, false, true); assertThat(caseInstance).isNotNull(); assertThat(caseInstance.getCaseStages()).hasSize(1); String stageId = caseInstance.getCaseStages().iterator().next().getId(); TaskSpecification dynamicTaskSpecification = caseService.newHumanTaskSpec(DYNAMIC_TASK, "", USER, null, Collections.emptyMap()); caseService.addDynamicTaskToStage(caseId, stageId, dynamicTaskSpecification); tasks = runtimeDataService.getTasksAssignedAsPotentialOwner(USER, new QueryFilter()); assertThat(tasks).hasSize(1); TaskSummary dynamicTask = tasks.get(0); assertThat(dynamicTask.getName()).isEqualTo(DYNAMIC_TASK); userTaskService.completeAutoProgress(dynamicTask.getId(), USER, null); assertCaseInstanceNotActive(caseId); }
Source:
public T getBestOffspring(T offspring1, T offspring2){ for (FitnessFunction<T> fitnessFunction : fitnessFunctions) { fitnessFunction.getFitness(offspring1); notifyEvaluation(offspring1); fitnessFunction.getFitness(offspring2); notifyEvaluation(offspring2); } if(keepOffspring(offspring1, offspring2)) return offspring2; else return offspring1; }

Target:
public T getBestOffspring(T offspring1, T offspring2){ for (FitnessFunction<T> fitnessFunction : fitnessFunctions) { fitnessFunction.getFitness(offspring1); notifyEvaluation(offspring1); fitnessFunction.getFitness(offspring2); notifyEvaluation(offspring2); } if(isBetterOrEqual(offspring1, offspring2)) return offspring2; else return offspring1; }
Source:
public boolean checkRequisitionAccountsAreUnique(RequisitionDocument requisitionDocument) { List<RequisitionItem> requisitionItems = requisitionDocument.getItems(); for (RequisitionItem requisitionItem : requisitionItems) { List<PurApAccountingLine> requisitionAccounts = requisitionItem.getSourceAccountingLines(); Set existingAccounts = new HashSet(); for(PurApAccountingLine purApAccountingLine : requisitionAccounts) { if (!existingAccounts.contains(purApAccountingLine.toString())) { existingAccounts.add(purApAccountingLine.toString()); } else { GlobalVariables.getMessageMap().putError(PurapConstants.ITEM_TAB_ERROR_PROPERTY, PurapKeyConstants.ERROR_ITEM_ACCOUNTING_NOT_UNIQUE, requisitionItem.getItemIdentifierString()); String errorMessage = getDuplicateAccountErrorMessage(purApAccountingLine, requisitionItem); LOG.error(errorMessage); cuB2BShoppingErrorEmailService.sendDuplicateRequisitionAccountErrorEmail(requisitionDocument, errorMessage); return false; } } } return true; }

Target:
public boolean checkRequisitionAccountsAreUnique(RequisitionDocument requisitionDocument) { boolean requisitionAccountsUnique = true; uniqueRequisitionAccountValidator = getUniqueRequisitionAccountValidator(); List<RequisitionItem> requisitionItems = requisitionDocument.getItems(); for (RequisitionItem requisitionItem : requisitionItems) { uniqueRequisitionAccountValidator.setItemForValidation(requisitionItem); AttributedDocumentEvent attributedDocumentEvent = new AttributedRouteDocumentEvent(requisitionDocument); if (!uniqueRequisitionAccountValidator.validate(attributedDocumentEvent)) { requisitionAccountsUnique = false; handleDuplicateAccountError(requisitionDocument, requisitionItem); } } return requisitionAccountsUnique; }
Source:
public String getRoute() { final UndertowService service = this.undertowService.getValue(); final String defaultServerRoute = service.getInstanceId(); final String route = this.name.equals(service.getDefaultServer()) ? defaultServerRoute : String.join("-", defaultServerRoute, this.name); if (service.isObfuscateInstanceId()) { try { final MessageDigest md = MessageDigest.getInstance("MD5"); md.update(this.name.getBytes()); final Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); final String encodedRoute = encoder.encodeToString(md.digest(route.getBytes())); UndertowLogger.ROOT_LOGGER.obfuscatedInstanceIdRoute(encodedRoute, route); return encodedRoute; } catch (NoSuchAlgorithmException e) { UndertowLogger.ROOT_LOGGER.unableToObfuscateInstanceIdRoute(route, e); } } return route; }

Target:
public String getRoute() { final UndertowService service = this.undertowService.getValue(); final String defaultServerRoute = service.getInstanceId(); if (service.isObfuscateSessionRoute()) { try { final MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(this.name.getBytes(UTF_8)); final byte[] digestedBytes = md.digest(defaultServerRoute.getBytes(UTF_8)); final Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); final String encodedRoute = new String(encoder.encode(digestedBytes), UTF_8); UndertowLogger.ROOT_LOGGER.obfuscatedSessionRoute(encodedRoute, defaultServerRoute); return encodedRoute; } catch (NoSuchAlgorithmException e) { UndertowLogger.ROOT_LOGGER.unableToObfuscateSessionRoute(defaultServerRoute, e); } } return this.name.equals(service.getDefaultServer()) ? defaultServerRoute : String.join("-", defaultServerRoute, this.name); }
Source:
private static void sanityCheck(File file, int expectedSize) throws IOException { FileInputStream fis = new FileInputStream(file); CheckpointManager manager; try { manager = new CheckpointManager(params, fis); } catch (IOException ioe){ fis.close(); throw ioe; } checkState(manager.numCheckpoints() == expectedSize); if (params.getId().equals(NetworkParameters.ID_MAINNET)) { StoredBlock test = manager.getCheckpointBefore(1390500000); checkState(test.getHeight() == 280224); checkState(test.getHeader().getHashAsString() .equals("00000000000000000b5d59a15f831e1c45cb688a4db6b0a60054d49a9997fa34")); } else if (params.getId().equals(NetworkParameters.ID_TESTNET)) { StoredBlock test = manager.getCheckpointBefore(1390500000); checkState(test.getHeight() == 167328); checkState(test.getHeader().getHashAsString() .equals("0000000000035ae7d5025c2538067fe7adb1cf5d5d9c31b024137d9090ed13a9")); } fis.close(); }

Target:
private static void sanityCheck(File file, int expectedSize) throws IOException { FileInputStream fis = new FileInputStream(file); CheckpointManager manager; try { manager = new CheckpointManager(params, fis); } finally { fis.close(); } checkState(manager.numCheckpoints() == expectedSize); if (params.getId().equals(NetworkParameters.ID_MAINNET)) { StoredBlock test = manager.getCheckpointBefore(1390500000); checkState(test.getHeight() == 280224); checkState(test.getHeader().getHashAsString() .equals("00000000000000000b5d59a15f831e1c45cb688a4db6b0a60054d49a9997fa34")); } else if (params.getId().equals(NetworkParameters.ID_TESTNET)) { StoredBlock test = manager.getCheckpointBefore(1390500000); checkState(test.getHeight() == 167328); checkState(test.getHeader().getHashAsString() .equals("0000000000035ae7d5025c2538067fe7adb1cf5d5d9c31b024137d9090ed13a9")); } }
Source:
public static Index loadIndex(final String indexFile) { final Index idx = null; InputStream inputStream = null; BufferedInputStream bufferedInputStream = null; final LittleEndianInputStream dis = null; try { inputStream = ParsingUtils.openInputStream(indexFile); if (indexFile.endsWith(".gz")) { inputStream = new GZIPInputStream(inputStream); } else if (indexFile.endsWith(TabixUtils.STANDARD_INDEX_EXTENSION)) { inputStream = new BlockCompressedInputStream(inputStream); } bufferedInputStream = new BufferedInputStream(inputStream, Defaults.NON_ZERO_BUFFER_SIZE); final Class indexClass = IndexType.getIndexType(bufferedInputStream).getIndexType(); final Constructor ctor = indexClass.getConstructor(InputStream.class); return (Index) ctor.newInstance(bufferedInputStream); } catch (final IOException ex) { throw new TribbleException.UnableToReadIndexFile("Unable to read index file", indexFile, ex); } catch (final Exception ex) { throw new RuntimeException(ex); } finally { try { if (inputStream != null) inputStream.close(); if (bufferedInputStream != null) bufferedInputStream.close(); if (dis != null) dis.close(); } catch (final IOException e) { } } }

Target:
public static Index loadIndex(final String indexFile) { try (BufferedInputStream bufferedInputStream = new BufferedInputStream(indexFileInputStream(indexFile), Defaults.NON_ZERO_BUFFER_SIZE)){ final Class<Index> indexClass = IndexType.getIndexType(bufferedInputStream).getIndexType(); final Constructor<Index> ctor = indexClass.getConstructor(InputStream.class); return ctor.newInstance(bufferedInputStream); } catch (final IOException ex) { throw new TribbleException.UnableToReadIndexFile("Unable to read index file", indexFile, ex); } catch (final Exception ex) { throw new RuntimeException(ex); } }
Source:
public boolean initializeTaskData(TaskRepository repository, TaskData data, ITaskMapping initializationData, IProgressMonitor monitor) throws CoreException { data.setVersion("0"); if (data.isNew()) { BugzillaRestCreateTaskSchema.getDefault().initialize(data); } else { BugzillaRestTaskSchema.getDefault().initialize(data); } if (initializationData != null) { connector.getTaskMapping(data).merge(initializationData); } BugzillaRestConfiguration config = connector.getRepositoryConfiguration(repository); if (config != null) { config.updateInitialTaskData(data); } TaskAttribute addselfCC = data.getRoot().getAttribute(BugzillaRestTaskSchema.getDefault().ADD_SELF_CC.getKey()); addselfCC.putOption("UserName", repository.getUserName()); return true; }

Target:
public boolean initializeTaskData(TaskRepository repository, TaskData data, ITaskMapping initializationData, IProgressMonitor monitor) throws CoreException { data.setVersion("0"); if (data.isNew()) { BugzillaRestCreateTaskSchema.getDefault().initialize(data); } else { BugzillaRestTaskSchema.getDefault().initialize(data); } if (initializationData != null) { connector.getTaskMapping(data).merge(initializationData); } BugzillaRestConfiguration config = connector.getRepositoryConfiguration(repository); if (config != null) { config.updateInitialTaskData(data); } TaskAttribute addSelfCC = data.getRoot().getAttribute(BugzillaRestTaskSchema.getDefault().ADD_SELF_CC.getKey()); if (addSelfCC != null) { addSelfCC.getMetaData().putValue("UserName", repository.getUserName()); } return true; }
Source:
public void getLoadDone(IDMContext context, ILoadInfo load, Object arg) { VisualizerModel model = (VisualizerModel) arg; int l = Integer.valueOf(load.getLoad()); Integer wm = null; if (load.getHighLoadWaterMark() != null) { wm = Integer.valueOf(load.getHighLoadWaterMark()); } if (ICPUDMContext.class.isInstance(context)) { ICPUDMContext cpuContext = (ICPUDMContext) context; VisualizerCPU cpu = model.getCPU(Integer.parseInt(cpuContext.getId())); cpu.setLoadInfo(new VisualizerLoadInfo(l, wm)); } else if(ICoreDMContext.class.isInstance(context)) { ICoreDMContext coreContext = (ICoreDMContext) context; VisualizerCore core = model.getCore(Integer.parseInt(coreContext.getId())); core.setLoadInfo(new VisualizerLoadInfo(l, wm)); } }

Target:
public void getLoadDone(IDMContext context, ILoadInfo load, Object arg) { VisualizerModel model = (VisualizerModel) arg; Integer l = null, wm = null; if (load != null) { l = Integer.valueOf(load.getLoad()); if (load.getHighLoadWaterMark() != null) { wm = Integer.valueOf(load.getHighLoadWaterMark()); } } if (context instanceof ICPUDMContext) { ICPUDMContext cpuContext = (ICPUDMContext) context; VisualizerCPU cpu = model.getCPU(Integer.parseInt(cpuContext.getId())); cpu.setLoadInfo(new VisualizerLoadInfo(l, wm)); } else if(context instanceof ICoreDMContext) { ICoreDMContext coreContext = (ICoreDMContext) context; VisualizerCore core = model.getCore(Integer.parseInt(coreContext.getId())); core.setLoadInfo(new VisualizerLoadInfo(l, wm)); } }
Source:
public void close() { try { out.close(); } catch (IOException e) { throw new ParquetRuntimeException("Error closing output stream.", e){ }; } }

Target:
public void close() { out.close(); }
Source:
private void handleChatEvent(AsyncPlayerChatEvent event) { final Player player = event.getPlayer(); String message = event.getMessage().trim(); message = ChatColor.stripColor(message); if (message.length() > 250) { message = message.substring(0, 250); FSync.playerMsg(player, "Message was shortened because it was too long to send."); } if (message.length() >= 6) { int caps = 0; for (char c : message.toCharArray()) { if (Character.isUpperCase(c)) { caps++; } } if (((float) caps / (float) message.length()) > 0.65) { message = message.toLowerCase(); } } final FPlayer fPlayer = plugin.pl.getPlayerSync(player); if (fPlayer.inAdminChat()) { FSync.adminChatMessage(player, message); event.setCancelled(true); return; } event.setMessage(message); String format = "<%1$s> %2$s"; String tag = fPlayer.getTag(); if (tag != null && !tag.isEmpty()) { format = tag.replace("%", "%%") + " " + format; } event.setFormat(format); }

Target:
private void handleChatEvent(AsyncPlayerChatEvent event) { final Player player = event.getPlayer(); String message = event.getMessage().trim(); message = ChatColor.stripColor(message); if (message.length() > 256) { message = message.substring(0, 256); FSync.playerMsg(player, "Message was shortened because it was too long to send."); } if (message.length() >= 6) { int caps = 0; for (char c : message.toCharArray()) { if (Character.isUpperCase(c)) { caps++; } } if (((float) caps / (float) message.length()) > 0.65) { message = message.toLowerCase(); } } final FPlayer fPlayer = plugin.pl.getPlayerSync(player); if (fPlayer.inAdminChat()) { FSync.adminChatMessage(player, message); event.setCancelled(true); return; } event.setMessage(message); String format = "<%1$s> %2$s"; String tag = fPlayer.getTag(); if (tag != null && !tag.isEmpty()) { format = tag.replace("%", "%%") + " " + format; } event.setFormat(format); }
Source:
public void selectCommitByText(String text) { seleniumWebDriverHelper .waitVisibility(By.xpath(String.format(Locators.ITEM_WITH_TEXT_XPATH_TEMPLATE, text))) .click(); }

Target:
public void selectCommitByText(String text) { seleniumWebDriverHelper.waitAndClick( By.xpath(String.format(Locators.ITEM_WITH_TEXT_XPATH_TEMPLATE, text))); }
Source:
public static void unregisterFormat(String name) { if (formats.remove(name) == null) throw new JGitInternalException( "Archive format already absent: " + name); }

Target:
public static void unregisterFormat(String name) { if (formats.remove(name) == null) throw new JGitInternalException(MessageFormat.format( CLIText.get().archiveFormatAlreadyAbsent, name)); }
Source:
public static void refreshAllFeeds(final Context context) { if (!isRefreshing.compareAndSet(false, true)) { Log.d(TAG, "Ignoring request to refresh all feeds: Refresh lock is locked"); return; } if (Looper.myLooper() == Looper.getMainLooper()) { Log.wtf(TAG, "DBTasks.refreshAllFeeds() must not be called from the main thread"); return; } refreshFeeds(context, DBReader.getFeedList()); isRefreshing.set(false); SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, MODE_PRIVATE); prefs.edit().putLong(PREF_LAST_REFRESH, System.currentTimeMillis()).apply(); if (ClientConfig.gpodnetCallbacks.gpodnetEnabled()) { GpodnetSyncService.sendSyncIntent(context); } }

Target:
public static void refreshAllFeeds(final Context context) { if (!isRefreshing.compareAndSet(false, true)) { Log.d(TAG, "Ignoring request to refresh all feeds: Refresh lock is locked"); return; } if (Looper.myLooper() == Looper.getMainLooper()) { throw new IllegalStateException("DBTasks.refreshAllFeeds() must not be called from the main thread."); } refreshFeeds(context, DBReader.getFeedList()); isRefreshing.set(false); SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, MODE_PRIVATE); prefs.edit().putLong(PREF_LAST_REFRESH, System.currentTimeMillis()).apply(); if (ClientConfig.gpodnetCallbacks.gpodnetEnabled()) { GpodnetSyncService.sendSyncIntent(context); } }
Source:
public void scrape(HttpAction action) { ServletOps.responseSendError(action.response, HttpSC.NOT_IMPLEMENTED_501, "SimpleMeterRegistry isn't scrapeable" ); }

Target:
public void scrape(HttpAction action) { ServletOps.errorNotImplemented("SimpleMeterRegistry isn't scrapeable"); }
Source:
ParquetFileWriter(Configuration configuration, MessageType schema, Path file, long rowAndBlockSize, int maxPaddingSize) throws IOException { FileSystem fs = file.getFileSystem(configuration); this.schema = schema; this.alignment = PaddingAlignment.get( rowAndBlockSize, rowAndBlockSize, maxPaddingSize); this.out = HadoopStreams.wrap( fs.create(file, true, 8192, fs.getDefaultReplication(file), rowAndBlockSize)); this.encodingStatsBuilder = new EncodingStats.Builder(); this.columnIndexTruncateLength = Integer.MAX_VALUE; this.pageWriteChecksumEnabled = configuration.getBoolean( ParquetOutputFormat.PAGE_WRITE_CHECKSUM_ENABLED, ParquetProperties.DEFAULT_PAGE_WRITE_CHECKSUM_ENABLED); this.crc = pageWriteChecksumEnabled ? new CRC32() : null; }

Target:
ParquetFileWriter(Configuration configuration, MessageType schema, Path file, long rowAndBlockSize, int maxPaddingSize) throws IOException { FileSystem fs = file.getFileSystem(configuration); this.schema = schema; this.alignment = PaddingAlignment.get( rowAndBlockSize, rowAndBlockSize, maxPaddingSize); this.out = HadoopStreams.wrap( fs.create(file, true, 8192, fs.getDefaultReplication(file), rowAndBlockSize)); this.encodingStatsBuilder = new EncodingStats.Builder(); this.columnIndexTruncateLength = Integer.MAX_VALUE; this.pageWriteChecksumEnabled = ParquetOutputFormat.getPageWriteChecksumEnabled(configuration); this.crc = pageWriteChecksumEnabled ? new CRC32() : null; }
Source:
private boolean preDeleteValidation(CloudBlobMetadata metadata, StoreKey key, Map<String, Object> updateFields) throws StoreException { validateAccountAndContainer(Collections.singletonMap(key.getID(), metadata), Collections.singletonList(key)); short requestedLifeVersion = (short) updateFields.get(FIELD_LIFE_VERSION); if (isVcr) { return (!metadata.isDeleted() || metadata.getLifeVersion() < requestedLifeVersion) && (metadata.getLifeVersion() <= requestedLifeVersion); } if (requestedLifeVersion == MessageInfo.LIFE_VERSION_FROM_FRONTEND) { if (metadata.isDeleted()) { throw new StoreException( "Cannot delete id " + metadata.getId() + " since it is already marked as deleted in cloud.", StoreErrorCodes.ID_Deleted); } updateFields.remove(FIELD_LIFE_VERSION); } return true; }

Target:
private boolean preDeleteValidation(CloudBlobMetadata metadata, StoreKey key, Map<String, Object> updateFields) throws StoreException { validateAccountAndContainer(Collections.singletonMap(key.getID(), metadata), Collections.singletonList(key)); short requestedLifeVersion = (short) updateFields.get(FIELD_LIFE_VERSION); if (isVcr) { return (!metadata.isDeleted() || metadata.getLifeVersion() < requestedLifeVersion) && (metadata.getLifeVersion() <= requestedLifeVersion); } if (requestedLifeVersion == MessageInfo.LIFE_VERSION_FROM_FRONTEND) { if (metadata.isDeleted()) { throw new StoreException( "Cannot delete id " + key.getID() + " since it is already marked as deleted in cloud.", StoreErrorCodes.ID_Deleted); } updateFields.remove(FIELD_LIFE_VERSION); } return true; }