auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void emit(long previousRequested) { if (requested.get() == Long.MAX_VALUE) { if (previousRequested == 0) { try { for (Object value : deque) { if (subscriber.isUnsubscribed()) return; notification.accept(subscriber, value); } } catch (Throwable e) { Exceptions.throwOrReport(e, subscriber); } finally { deque.clear(); } } else { } } else { if (previousRequested == 0) { while (true) { long numToEmit = requested.get(); int emitted = 0; Object o; while (--numToEmit >= 0 && (o = deque.poll()) != null) { if (subscriber.isUnsubscribed()) { return; } if (notification.accept(subscriber, o)) { return; } else { emitted++; } } for (; ; ) { long oldRequested = requested.get(); long newRequested = oldRequested - emitted; if (oldRequested == Long.MAX_VALUE) { break; } if (requested.compareAndSet(oldRequested, newRequested)) { if (newRequested == 0) { return; } break; } } } } } }

Target:
void emit(long previousRequested) { if (get() == Long.MAX_VALUE) { if (previousRequested == 0) { try { for (Object value : deque) { if (subscriber.isUnsubscribed()) return; notification.accept(subscriber, value); } } catch (Throwable e) { Exceptions.throwOrReport(e, subscriber); } finally { deque.clear(); } } else { } } else { if (previousRequested == 0) { while (true) { long numToEmit = get(); int emitted = 0; Object o; while (--numToEmit >= 0 && (o = deque.poll()) != null) { if (subscriber.isUnsubscribed()) { return; } if (notification.accept(subscriber, o)) { return; } else { emitted++; } } for (; ; ) { long oldRequested = get(); long newRequested = oldRequested - emitted; if (oldRequested == Long.MAX_VALUE) { break; } if (compareAndSet(oldRequested, newRequested)) { if (newRequested == 0) { return; } break; } } } } } }
Source:
protected List<String> initialKnifeParameters() { MutableList<String> result = new MutableList<String>(); SshMachineLocation machine = EffectorTasks.findSshMachine(); result.add("bootstrap"); result.addAll(extraBootstrapParameters); HostAndPort hostAndPort = machine.getSshHostAndPort(); result.add(wrapBash(hostAndPort.getHostText())); result.add("-p "+hostAndPort.getPort()); result.add("-x "+wrapBash(checkNotNull(machine.getUser(), "user"))); File keyfile = ChefServerTasks.extractKeyFile(machine); if (keyfile!=null) result.add("-i "+keyfile.getPath()); else result.add("-P "+checkNotNull(machine.findPassword(), "No password or private key data for "+machine)); if (sudo != Boolean.FALSE) result.add("--sudo"); if (!Strings.isNullOrEmpty(nodeName)) { result.add("--node-name"); result.add(nodeName); } result.add("-r "+wrapBash(runList.apply(entity()))); if (!knifeAttributes.isEmpty()) result.add("-j "+wrapBash(new GsonBuilder().create() .toJson(knifeAttributes))); return result; }

Target:
protected List<String> initialKnifeParameters() { MutableList<String> result = new MutableList<String>(); SshMachineLocation machine = EffectorTasks.findSshMachine(); result.add("bootstrap"); result.addAll(extraBootstrapParameters); HostAndPort hostAndPort = machine.getSshHostAndPort(); result.add(wrapBash(hostAndPort.getHostText())); Integer whichPort = knifeWhichPort(hostAndPort); if (whichPort!=null) result.add("-p "+whichPort); result.add("-x "+wrapBash(checkNotNull(machine.getUser(), "user"))); File keyfile = ChefServerTasks.extractKeyFile(machine); if (keyfile!=null) result.add("-i "+keyfile.getPath()); else result.add("-P "+checkNotNull(machine.findPassword(), "No password or private key data for "+machine)); if (sudo != Boolean.FALSE) result.add("--sudo"); if (!Strings.isNullOrEmpty(nodeName)) { result.add("--node-name"); result.add(nodeName); } result.add("-r "+wrapBash(runList.apply(entity()))); if (!knifeAttributes.isEmpty()) result.add("-j "+wrapBash(new GsonBuilder().create() .toJson(knifeAttributes))); return result; }
Source:
private AuthenticationResult createAuthenticationResult() { val mock = mock(AuthenticationResult.class); val authentication = createAuthentication(); when(mock.getAuthentication()).thenReturn(authentication); when(mock.getService()).thenReturn(createService()); return mock; }

Target:
private AuthenticationResult createAuthenticationResult() { val authentication = createAuthentication(); val mock = CoreAuthenticationTestUtils.getAuthenticationResult(authentication); return mock; }
Source:
public void MinimalWordCountTest() { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); MinimalWordCount app = new MinimalWordCount(); try { lma.prepareDAG(app, conf); } catch (Exception e) { e.printStackTrace(); } LocalMode.Controller lc = lma.getController(); lc.run(10000); }

Target:
public void MinimalWordCountTest() throws Exception { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); MinimalWordCount app = new MinimalWordCount(); lma.prepareDAG(app, conf); LocalMode.Controller lc = lma.getController(); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return MinimalWordCount.Collector.isDone(); } }); lc.run(10000); Assert.assertTrue(MinimalWordCount.Collector.result.get("error") == 7); Assert.assertTrue(MinimalWordCount.Collector.result.get("word") == 119); Assert.assertTrue(MinimalWordCount.Collector.result.get("bye") == 1); }
Source:
public void testGetPublicKeyPairNullInput1() { try{ KeyGenUtils.getPublicKeyPair(null, truePublicKeys[0]); } catch (UnsupportedTypeException e) { fail("UnsupportedTypeException thrown"); } }

Target:
public void testGetPublicKeyPairNullInput1() { KeyGenUtils.getPublicKeyPair(null, truePublicKeys[0]); }
Source:
public boolean addOffHeapResource(OffHeapResourceIdentifier identifier, long capacityInBytes) { boolean wasAdded = addToResources(identifier, capacityInBytes); if (wasAdded) { for (EntityManagementRegistry registry : registries) { OffHeapResourceBinding managementBinding = getOffHeapResource(identifier).getManagementBinding(); registry.register(managementBinding); registry.refresh(); } } return wasAdded; }

Target:
public boolean addOffHeapResource(OffHeapResourceIdentifier identifier, long capacityInBytes) { boolean wasAdded = addToResources(identifier, capacityInBytes); if (wasAdded) { for (EntityManagementRegistry registry : registries) { OffHeapResourceBinding managementBinding = getOffHeapResource(identifier).getManagementBinding(); registry.registerAndRefresh(managementBinding); } } return wasAdded; }
Source:
public void open(int taskNumber, int numTasks) throws IOException { super.open(taskNumber, numTasks); DatumWriter<E> datumWriter; Schema schema = null; if (org.apache.avro.specific.SpecificRecordBase.class.isAssignableFrom(avroValueType)) { datumWriter = new SpecificDatumWriter<E>(avroValueType); try { schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } else { datumWriter = new ReflectDatumWriter<E>(avroValueType); schema = ReflectData.get().getSchema(avroValueType); } dataFileWriter = new DataFileWriter<E>(datumWriter); dataFileWriter.create(schema, this.stream); }

Target:
public void open(int taskNumber, int numTasks) throws IOException { super.open(taskNumber, numTasks); DatumWriter<E> datumWriter; Schema schema = null; if (org.apache.avro.specific.SpecificRecordBase.class.isAssignableFrom(avroValueType)) { datumWriter = new SpecificDatumWriter<E>(avroValueType); try { schema = ((org.apache.avro.specific.SpecificRecordBase)avroValueType.newInstance()).getSchema(); } catch (InstantiationException e) { throw new RuntimeException(e.getMessage()); } catch (IllegalAccessException e) { throw new RuntimeException(e.getMessage()); } } else { datumWriter = new ReflectDatumWriter<E>(avroValueType); schema = ReflectData.get().getSchema(avroValueType); } dataFileWriter = new DataFileWriter<E>(datumWriter); if (userDefinedSchema == null) { dataFileWriter.create(schema, stream); } else { dataFileWriter.create(userDefinedSchema, stream); } }
Source:
public <T> T transform(Object value, Class<T> type) { Object returnValue = null; if (value == null) { return null; } if (ClassUtils.isAssignable(type, java.time.LocalDateTime.class)) { returnValue = toZonedDateTime((Calendar) value).toLocalDateTime(); } else if (ClassUtils.isAssignable(type, java.time.LocalDate.class)) { returnValue = toZonedDateTime((Calendar) value).toLocalDate(); } else if (ClassUtils.isAssignable(type, java.time.LocalTime.class)) { returnValue = toZonedDateTime((Calendar) value).toLocalTime(); } else if (ClassUtils.isAssignable(type, java.time.OffsetDateTime.class)) { returnValue = toZonedDateTime((Calendar) value).toOffsetDateTime(); } else if (ClassUtils.isAssignable(type, java.time.ZonedDateTime.class)) { returnValue = toZonedDateTime((Calendar) value); } else if (ClassUtils.isAssignable(type, java.time.OffsetTime.class)) { returnValue = toZonedDateTime((Calendar) value).toOffsetDateTime().toOffsetTime(); } else if (ClassUtils.isAssignable(type, java.time.Instant.class)) { returnValue = ((Calendar) value).toInstant(); } else if (ClassUtils.isAssignable(type, java.time.Instant.class)) { returnValue = ((Calendar) value).toInstant(); } else { throw new IllegalArgumentException("Incorrect type for transformer: " + type.getCanonicalName()); } return type.cast(returnValue); }

Target:
public <T> T transform(Object value, Class<T> type) { Object returnValue = null; if (value == null) { return null; } if (ClassUtils.isAssignable(type, java.time.LocalDateTime.class)) { returnValue = toZonedDateTime((Calendar) value).toLocalDateTime(); } else if (ClassUtils.isAssignable(type, java.time.LocalDate.class)) { returnValue = toZonedDateTime((Calendar) value).toLocalDate(); } else if (ClassUtils.isAssignable(type, java.time.LocalTime.class)) { returnValue = toZonedDateTime((Calendar) value).toLocalTime(); } else if (ClassUtils.isAssignable(type, java.time.OffsetDateTime.class)) { returnValue = toZonedDateTime((Calendar) value).toOffsetDateTime(); } else if (ClassUtils.isAssignable(type, java.time.ZonedDateTime.class)) { returnValue = toZonedDateTime((Calendar) value); } else if (ClassUtils.isAssignable(type, java.time.OffsetTime.class)) { returnValue = toZonedDateTime((Calendar) value).toOffsetDateTime().toOffsetTime(); } else if (ClassUtils.isAssignable(type, java.time.Instant.class)) { returnValue = ((Calendar) value).toInstant(); } else { throw new IllegalArgumentException("Incorrect type for transformer: " + type.getCanonicalName()); } return type.cast(returnValue); }
Source:
public String getHumanishName() throws IllegalArgumentException { if ("".equals(getPath()) || getPath() == null) throw new IllegalArgumentException(); String[] elements = getPath().split("/"); if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; if (DOT_GIT.equals(result)) result = elements[elements.length - 2]; else if (result.endsWith(DOT_GIT)) result = result.substring(0, result.length() - DOT_GIT.length()); if ("".equals(result)) throw new IllegalArgumentException(); return result; }

Target:
public String getHumanishName() throws IllegalArgumentException { if ("".equals(getPath()) || getPath() == null) throw new IllegalArgumentException(); String[] elements = getPath().split("/"); if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; if (DOT_GIT.equals(result)) result = elements[elements.length - 2]; else if (result.endsWith(DOT_GIT)) result = result.substring(0, result.length() - DOT_GIT.length()); return result; }
Source:
protected boolean isAnyVmRunOnVdsInDb(Guid vdsId) { if (!Config.<Boolean>getValue(ConfigValues.MaintenanceVdsIgnoreExternalVms)) { return vmDynamicDao.isAnyVmRunOnVds(vdsId); } return !vmStaticDao.getAllRunningForVds(vdsId) .stream() .filter(vm -> !OriginType.EXTERNAL.equals(vm.getOrigin())) .collect(Collectors.toList()) .isEmpty(); }

Target:
protected boolean isAnyVmRunOnVdsInDb(Guid vdsId) { return vmDynamicDao.isAnyVmRunOnVds(vdsId); }
Source:
private <T extends Metric> T find(String name, Class<T> type) { A.notNull(name, "name"); String[] splited = fromFullName(name); MetricRegistry mreg = registries.get(splited[0]); if (mreg == null) { if (log.isInfoEnabled()) log.info("Metric registry not found[registry=" + splited[0] + ']'); return null; } Metric m = mreg.findMetric(splited[1]); if (m == null) { if (log.isInfoEnabled()) log.info("Metric not found[registry=" + splited[0] + ", metricName=" + splited[1] + ']'); return null; } if (!m.getClass().isAssignableFrom(type)) { log.error("Metric '" + name + "' should be a HitRate[type=" + m.getClass().getSimpleName() + ']'); return null; } return (T) m; }

Target:
private <T extends Metric> T find(String name, Class<T> type) { A.notNull(name, "name"); T2<String, String> splitted = fromFullName(name); MetricRegistry mreg = registries.get(splitted.get1()); if (mreg == null) { if (log.isInfoEnabled()) log.info("Metric registry not found[registry=" + splitted.get1() + ']'); return null; } Metric m = mreg.findMetric(splitted.get2()); if (m == null) { if (log.isInfoEnabled()) log.info("Metric not found[registry=" + splitted.get1() + ", metricName=" + splitted.get2() + ']'); return null; } if (!m.getClass().isAssignableFrom(type)) { log.error("Metric '" + name + "' has wrong type[type=" + m.getClass().getSimpleName() + ']'); return null; } return (T) m; }
Source:
public void testGetDocument() throws FileNotFoundException, DocumentException { final LabelPaper paper = LabelPaperFactory.generateLabelPaper(3, 9, 1); Document document = this.pdfLabelsFileGenerator.getDocument(new FileOutputStream("temp"), paper, 1); Assert.assertNotNull(document); Assert.assertEquals(PageSize.A4, document.getPageSize()); document = this.pdfLabelsFileGenerator.getDocument(new FileOutputStream("temp"), paper, 2); Assert.assertEquals(PageSize.LETTER, document.getPageSize()); }

Target:
public void testGetDocument() throws DocumentException, IOException { LabelPaper paper = LabelPaper.PAPER_3_BY_7_A4; final FileOutputStream fileOutputStream = new FileOutputStream("temp"); Document document = this.pdfLabelsFileGenerator.getDocument(fileOutputStream, paper, 1); Assert.assertNotNull(document); Assert.assertEquals(PageSize.A4, document.getPageSize()); paper = LabelPaper.PAPER_3_BY_7_LETTER; document = this.pdfLabelsFileGenerator.getDocument(fileOutputStream, paper, 2); Assert.assertEquals(PageSize.LETTER, document.getPageSize()); fileOutputStream.close(); }
Source:
public Collection<Disk> aggregateDiskImagesSnapshots(List<DiskImage> images){ Map<Guid, DiskImage> diskImagesMap = new HashMap<>(); images.forEach(diskImage -> { if (diskImage.getActive()) { diskImage.getSnapshots().add(DiskImage.copyOf(diskImage)); diskImagesMap.put(diskImage.getId(), diskImage); } }); images.forEach(diskImage -> { if (!diskImage.getActive()) { diskImagesMap.get(diskImage.getId()).getSnapshots().add(diskImage); } }); return new ArrayList<>(diskImagesMap.values()); }

Target:
public Collection<DiskImage> aggregateDiskImagesSnapshots(List<DiskImage> images){ Map<Guid, DiskImage> diskImagesMap = new HashMap<>(); images.forEach(diskImage -> { if (diskImage.getActive()) { diskImage.getSnapshots().add(DiskImage.copyOf(diskImage)); diskImagesMap.put(diskImage.getId(), diskImage); } }); images.forEach(diskImage -> { if (!diskImage.getActive()) { diskImagesMap.get(diskImage.getId()).getSnapshots().add(diskImage); } }); return diskImagesMap.values(); }
Source:
private void enforceAttemptTTLs() { Instant creationDeadline = ssm.getStoreTime().minus(attemptTTL); int state = 0; long lastId = 0; List<StoredSessionAttempt> expiredAttempts = ssm.findAttemptsCreatedBeforeWithState(creationDeadline, state, lastId, 100); for (StoredSessionAttempt attempt : expiredAttempts) { AttemptStateFlags stateFlags; try { stateFlags = ssm.getAttemptStateFlags(attempt.getId()); } catch (ResourceNotFoundException e) { logger.debug("Session Attempt not found, ignoring: {}", attempt, e); continue; } if (stateFlags.isCancelRequested()) { logger.debug("Session Attempt already canceled, ignoring: {}", attempt); continue; } logger.info("Session Attempt timed out, canceling: {}", attempt); ssm.requestCancelAttempt(attempt.getId()); } }

Target:
private void enforceAttemptTTLs() { Instant creationDeadline = ssm.getStoreTime().minus(attemptTTL); List<StoredSessionAttempt> expiredAttempts = ssm.findActiveAttemptsCreatedBefore(creationDeadline, (long) 0, 100); for (StoredSessionAttempt attempt : expiredAttempts) { AttemptStateFlags stateFlags; try { stateFlags = ssm.getAttemptStateFlags(attempt.getId()); } catch (ResourceNotFoundException e) { logger.debug("Session Attempt not found, ignoring: {}", attempt, e); continue; } if (stateFlags.isCancelRequested()) { logger.debug("Session Attempt already canceled, ignoring: {}", attempt); continue; } logger.info("Session Attempt timed out, canceling: {}", attempt); boolean canceled = ssm.requestCancelAttempt(attempt.getId()); if (canceled) { sendTimeoutNotification("Workflow execution timeout", attempt.getId()); } } }
Source:
public DatabaseMetricsService(DataSourceFactory dataSourceFactory, MetricRegistry metricRegistry, String databaseName) { this.dataSourceFactory = dataSourceFactory; this.databaseName = databaseName; initialiseMetrics(metricRegistry); }

Target:
public DatabaseMetricsService(DataSourceFactory dataSourceFactory, MetricRegistry metricRegistry, String databaseName) { this.dataSourceFactory = dataSourceFactory; this.databaseName = databaseName; metrics.forEach(metric -> metric.register(metricRegistry, format("%sdb.", databaseName))); metricRegistry.<Gauge<Integer>>register(format("%sdb.stats_healthy", databaseName), () -> statsHealthy); }
Source:
public ResponseEntity addPrivilegesToAnonymous(@RequestBody @Validated PrivilegeListForm privilegeListForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) { if (privilegeListForm == null) { throw new RequestBodyValidationException("Empty request body", bindingResult); } if (bindingResult.hasErrors()) { String message = "Privileges cannot be saved because the submitted form contains errors!"; throw new RequestBodyValidationException(message, bindingResult); } TypeDescriptor sourceType = TypeDescriptor.valueOf(PrivilegeListForm.class); TypeDescriptor targetType = TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Privilege.class)); List<Privilege> privilegeList = (List<Privilege>) conversionService.convert(privilegeListForm, sourceType, targetType); return processConfig(config -> Objects.requireNonNull(privilegeList).forEach(this::addAnonymousAuthority), () -> SUCCESSFUL_ASSIGN_PRIVILEGES, acceptHeader); }

Target:
public ResponseEntity addPrivilegesToAnonymous(@RequestBody @Validated PrivilegeListForm privilegeListForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_ASSIGN_PRIVILEGES, bindingResult); } TypeDescriptor sourceType = TypeDescriptor.valueOf(PrivilegeListForm.class); TypeDescriptor targetType = TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Privilege.class)); List<Privilege> privilegeList = (List<Privilege>) conversionService.convert(privilegeListForm, sourceType, targetType); return processConfig(config -> Objects.requireNonNull(privilegeList).forEach(this::addAnonymousAuthority), () -> SUCCESSFUL_ASSIGN_PRIVILEGES, acceptHeader); }
Source:
public static ForLoadedType of(Class<?> type) { ForLoadedType res = (ForLoadedType) WELLKNOWN_TYPE_MAP.get(type); if (res != null) { return res; } return new ForLoadedType(type); }

Target:
public static TypeDescription of(Class<?> type) { TypeDescription res = TypeDescription.TypeCache.WELLKNOWN_TYPE_MAP.get(type); if (res != null) { return res; } return new ForLoadedType(type); }
Source:
public void logOut() { mutableIdentityStore.logOut(); isLoggedInBehaviorSubject.onNext(false); analytics.record(Events.Identity.UserLogout); }

Target:
public void logOut() { mutableIdentityStore.logOut(); isLoggedInBehaviorSubject.onNext(false); analytics.record(Events.Identity.UserLogout); Logger.info(this, "User logged out"); }
Source:
public static List<Optional<ApiResponses>> findApiResponsesAnnotations(AnnotatedElement annotated) { return newArrayList( fromNullable(getAnnotation(annotated, ApiResponses.class)), fromNullable(annotated instanceof Method ? findAnnotation(((Method) annotated).getDeclaringClass(), ApiResponses.class) : (ApiResponses) null ) ); }

Target:
public static List<ApiResponses> findApiResponsesAnnotations(AnnotatedElement annotated) { List<ApiResponses> results = newArrayList(); ApiResponses currentLevel = getAnnotation(annotated, ApiResponses.class); if (currentLevel != null) { results.add(currentLevel); } if (annotated instanceof Method) { ApiResponses parentLevel = findAnnotation(((Method)annotated).getDeclaringClass(), ApiResponses.class); if (parentLevel != null) { results.add(parentLevel); } } return results; }
Source:
public void includeSample( IndexEntryUpdate update ) { nativePopulator.includeSample( update ); lucenePopulator.includeSample( update ); }

Target:
public void includeSample( IndexEntryUpdate update ) { selector.select( nativePopulator, lucenePopulator, update.values() ).includeSample( update ); }
Source:
public void shutdown() { this.interrupt(); LOG.info("Shutdown datastream {}", _datastreamGroup.getName()); }

Target:
public void shutdown() { this.interrupt(); LOG.info("PartitionListenerThread Shutdown called for datastreamgroup {}", _datastreamGroup.getName()); }
Source:
public VisualEditorPageObject closeDialog() { waitForElementClickableByElement(closeButton); closeButton.click(); PageObjectLogging.log("closeDialog", "Closed button on the dialog is clicked", true); waitForElementNotVisibleByElement(dialog); PageObjectLogging.log("closeDialog", "Dialog is closed", true); return new VisualEditorPageObject(driver); }

Target:
public VisualEditorPageObject closeDialog() { waitForDialogVisible(); waitForElementClickableByElement(closeButton); closeButton.click(); waitForDialogNotVisible(); PageObjectLogging.log("closeDialog", "Dialog is closed", true); return new VisualEditorPageObject(driver); }
Source:
public static void addZKStartStopAuditLog() { if (isAuditEnabled) { ZKAuditLogger.logSuccess(getZKUser(), AuditConstants.OP_START); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { ZKAuditLogger.logInvoked(getZKUser(), AuditConstants.OP_STOP); } }); } }

Target:
public static void addZKStartStopAuditLog() { if (isAuditEnabled()) { ZKAuditLogger.logSuccess(getZKUser(), AuditConstants.OP_START); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { ZKAuditLogger.logInvoked(getZKUser(), AuditConstants.OP_STOP); } }); } }
Source:
int getGlobalTermsStringResource(FlowParameters flowParameters) { boolean termsOfServiceUrlProvided = flowParameters.isTermsOfServiceUrlProvided(); boolean privacyPolicyUrlProvided = flowParameters.isPrivacyPolicyUrlProvided(); if (termsOfServiceUrlProvided && privacyPolicyUrlProvided) { return R.string.fui_tos_and_pp; } else if (termsOfServiceUrlProvided) { return R.string.fui_tos_only; } else if (privacyPolicyUrlProvided) { return R.string.fui_pp_only; } return NO_TOS_OR_PP; }

Target:
private static int getGlobalTermsStringResource(FlowParameters flowParameters) { boolean termsOfServiceUrlProvided = flowParameters.isTermsOfServiceUrlProvided(); boolean privacyPolicyUrlProvided = flowParameters.isPrivacyPolicyUrlProvided(); if (termsOfServiceUrlProvided && privacyPolicyUrlProvided) { return R.string.fui_tos_and_pp; } else if (termsOfServiceUrlProvided) { return R.string.fui_tos_only; } else if (privacyPolicyUrlProvided) { return R.string.fui_pp_only; } return NO_TOS_OR_PP; }
Source:
public void provision( InternalEnvironment environment, OpenShiftEnvironment osEnv, RuntimeIdentity runtimeIdentity) throws InfrastructureException { if (pvcEnable) { final String workspaceId = runtimeIdentity.getWorkspaceId(); final String pvcUniqueName; switch (pvcStrategy) { case UNIQUE: pvcUniqueName = pvcName + '-' + workspaceId; break; case COMMON: pvcUniqueName = pvcName; break; default: throw new IllegalArgumentException( format("Unsupported PVC strategy '%s' configured", pvcStrategy)); } osEnv .getPersistentVolumeClaims() .put( pvcUniqueName, new PersistentVolumeClaimBuilder() .withNewMetadata() .withName(pvcUniqueName) .endMetadata() .withNewSpec() .withAccessModes(pvcAccessMode) .withNewResources() .withRequests(ImmutableMap.of("storage", new Quantity(pvcQuantity))) .endResources() .endSpec() .build()); final String machineWithSources = WsAgentMachineFinderUtil.getWsAgentServerMachine(environment) .orElseThrow(() -> new InfrastructureException("Machine with wsagent not found")); for (Pod pod : osEnv.getPods().values()) { for (Container container : pod.getSpec().getContainers()) { final String machineName = pod.getMetadata().getName() + "/" + container.getName(); if (machineWithSources.equals(machineName)) { final VolumeMount volumeMount = new VolumeMountBuilder() .withMountPath(projectFolderPath) .withName(pvcUniqueName) .withSubPath(workspaceId + projectFolderPath) .build(); container.getVolumeMounts().add(volumeMount); final PersistentVolumeClaimVolumeSource pvcs = new PersistentVolumeClaimVolumeSourceBuilder().withClaimName(pvcUniqueName).build(); final Volume volume = new VolumeBuilder().withPersistentVolumeClaim(pvcs).withName(pvcUniqueName).build(); pod.getSpec().getVolumes().add(volume); return; } } } } }

Target:
public void provision( InternalEnvironment environment, OpenShiftEnvironment osEnv, RuntimeIdentity runtimeIdentity) throws InfrastructureException { if (pvcEnable) { pvcStrategy.prepare(environment, osEnv, runtimeIdentity.getWorkspaceId()); } }
Source:
private void verifySubPolicy(Policy subPolicy) throws InvalidPolicyAttributes { if (subPolicy == null) { return; } if (!(subPolicy instanceof FactorsPolicy) && !(subPolicy instanceof MethodAmountPolicy)) { throw new InvalidPolicyAttributes("Inside or Outside Policy objects must be of type FactorsPolicy or MethodAmountPolicy, or null if no policy", null, null); } if (subPolicy.getDenyEmulatorSimulator() || subPolicy.getDenyRootedJailbroken()) { throw new InvalidPolicyAttributes("Inside or Outside Policy objects must have denyEmulatorSimulator or denyRootedJailbroken set to false", null, null); } if (subPolicy.getFences() != null) { throw new InvalidPolicyAttributes("Fences are not supported on Inside or Outside Policy objects",null,null); } }

Target:
private void verifySubPolicy(Policy subPolicy) throws InvalidPolicyAttributes { if (subPolicy == null) { throw new InvalidPolicyAttributes("Inside or Outside Policy objects must not be null", null, null); } else if (!(subPolicy instanceof FactorsPolicy) && !(subPolicy instanceof MethodAmountPolicy)) { throw new InvalidPolicyAttributes("Inside or Outside Policy objects must be of type FactorsPolicy or MethodAmountPolicy", null, null); } if (subPolicy.getDenyEmulatorSimulator() || subPolicy.getDenyRootedJailbroken()) { throw new InvalidPolicyAttributes("Inside or Outside Policy objects must have denyEmulatorSimulator or denyRootedJailbroken set to false", null, null); } if (subPolicy.getFences() != null) { throw new InvalidPolicyAttributes("Fences are not supported on Inside or Outside Policy objects",null,null); } }
Source:
private boolean updateRelevantVms() { List<VM> vms = getVmsDiskPluggedTo(); boolean updateAllVmsSucceeded = true; if (vms.isEmpty()) { return extendFloatingDiskSize(); } for (VM vm : vms) { try { VDSReturnValue ret = extendVmDiskSize(vm, getParameters().getNewSize()); if (!ret.getSucceeded()) { updateAuditLogFailedToUpdateVM(vm.getName()); } } catch (EngineException e) { log.warn("Failed to update VM '{}' with the new volume size due to error, " + "VM should be restarted to detect the new size: {}", vm.getName(), e.getMessage()); log.debug("Exception", e); updateAuditLogFailedToUpdateVM(vm.getName()); updateAllVmsSucceeded = false; } } return updateAllVmsSucceeded; }

Target:
private boolean updateRelevantVms() { List<VM> vms = getVmsDiskPluggedTo(); if (vms.isEmpty()) { return extendFloatingDiskSize(); } boolean updateAllVmsSucceeded = true; for (VM vm : vms) { try { VDSReturnValue ret = extendVmDiskSize(vm, getParameters().getNewSize()); if (!ret.getSucceeded()) { updateAuditLogFailedToUpdateVM(vm.getName()); } } catch (EngineException e) { log.warn("Failed to update VM '{}' with the new volume size due to error, " + "VM should be restarted to detect the new size: {}", vm.getName(), e.getMessage()); log.debug("Exception", e); updateAuditLogFailedToUpdateVM(vm.getName()); updateAllVmsSucceeded = false; } } return updateAllVmsSucceeded; }
Source:
public RunningOperation(SpliceOperation operation, Thread thread, Date submittedTime, DataSetProcessor.Type engine, UUID uuid, String rdbIntTkn) { this.operation = operation; this.thread =thread; this.submittedTime = (Date)submittedTime.clone(); this.engine = engine; this.uuid = uuid; this.rdbIntTkn = rdbIntTkn; }

Target:
public RunningOperation(SpliceOperation operation, Thread thread, Date submittedTime, DataSetProcessor.Type engine, UUID uuid, String rdbIntTkn) { this.operation = operation; this.thread =thread; this.submittedTime = submittedTime; this.engine = engine; this.uuid = uuid; this.rdbIntTkn = rdbIntTkn; }
Source:
private void updateStatusOfPushMessageInformation(final PushMessageInformation pushMessageInformation, final String variantID, final int receivers, final Boolean deliveryStatus, final String reason) { final VariantMetricInformation variantMetricInformation = new VariantMetricInformation(); variantMetricInformation.setPushMessageInformation(pushMessageInformation); variantMetricInformation.setVariantID(variantID); variantMetricInformation.setReceivers(receivers); variantMetricInformation.setDeliveryStatus(deliveryStatus); variantMetricInformation.setReason(reason); pushMessageInformation.getVariantInformations().add(variantMetricInformation); dispatchVariantMetricEvent.fire(variantMetricInformation); }

Target:
private void updateStatusOfPushMessageInformation(final PushMessageInformation pushMessageInformation, final String variantID, final int receivers, final Boolean deliveryStatus, final String reason) { final VariantMetricInformation variantMetricInformation = new VariantMetricInformation(); variantMetricInformation.setPushMessageInformation(pushMessageInformation); variantMetricInformation.setVariantID(variantID); variantMetricInformation.setReceivers(receivers); variantMetricInformation.setDeliveryStatus(deliveryStatus); variantMetricInformation.setReason(reason); dispatchVariantMetricEvent.fire(variantMetricInformation); }
Source:
public final void afterPropertiesSet() throws Exception { Assert.notNull(this.applicationContext, "The 'applicationContext' property must not be null"); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } if (this instanceof IntegrationFlowFunctionSupportAware) { ((IntegrationFlowFunctionSupportAware)this).setIntegrationFlowFunctionSupport(integrationFlowFunctionSupport); } onInit(); }

Target:
public final void afterPropertiesSet() throws Exception { Assert.notNull(this.applicationContext, "The 'applicationContext' property must not be null"); if (this.evaluationContext == null) { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); } onInit(); }
Source:
public void tapOnPointXY(int pointX, int pointY, int duration, int waitAfter) { pointX = (int)((pointX / 100f) * appNativeWidth); pointY = (int)(((pointY / 100f) * appNativeHeight) + taskbarNativeHeight); if (mobileDriver.getContext() != "NATIVE_APP") { mobileDriver.context("NATIVE_APP"); } try { mobileDriver.tap(1, pointX, pointY, duration); } catch (Exception e) try { Thread.sleep(waitAfter); } catch (Exception e) if (mobileDriver.getContext() != "WEBVIEW_1") { mobileDriver.context("WEBVIEW_1"); } }

Target:
public void tapOnPointXY(int pointX, int pointY, int duration, int waitAfter) { String methodName = "tapOnPointXY"; pointX = (int)((pointX / 100f) * appNativeWidth); pointY = (int)(((pointY / 100f) * appNativeHeight) + taskbarNativeHeight); switchToContext(CONTEXT_NATIVE_APP, methodName); mobileDriver.tap(1, pointX, pointY, duration); waitForFinish(waitAfter, methodName); switchToContext(CONTEXT_WEBVIEW_1, methodName); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GitlabProject that = (GitlabProject) o; return id != null ? id.equals(that.id) : that.id == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GitlabProject that = (GitlabProject) o; if (id != null || that.id != null) { return id != null && id.equals(that.id); } else { if (name != null ? !name.equals(that.name) : that.name != null) return false; return namespace != null ? namespace.equals(that.namespace) : that.namespace == null; } }
Source:
public SharedRealm getSharedRealm() { return sharedRealm; }

Target:
SharedRealm getSharedRealm() { return sharedRealm; }
Source:
public void postGetHeadDeleteTest() throws Exception { for (Container container : refAccount.getAllContainers()) { doPostGetHeadDeleteTest(refAccount, container, refAccount, container); } doPostGetHeadDeleteTest(null, null, refAccount, refDefaultPublicContainer); doPostGetHeadDeleteTest(null, null, refAccount, refDefaultPrivateContainer); }

Target:
public void postGetHeadDeleteTest() throws Exception { short accountId; String accountName; do { accountId = Utils.getRandomShort(TestUtils.RANDOM); accountName = UtilsTest.getRandomString(10); } while (accountId == refAccount.getId() || accountName.equals(refAccount.getName())); Container randomContainer = getRandomContainer(accountId); Container defaultPublicContainer = getDefaultContainer(accountId, false); Container defaultPrivateContainer = getDefaultContainer(accountId, true); Account account = new AccountBuilder(accountId, accountName, Account.AccountStatus.ACTIVE, Arrays.asList(defaultPublicContainer, defaultPrivateContainer, randomContainer)).build(); accountService.updateAccounts(Collections.singletonList(account)); for (Account testAccount : accountService.getAllAccounts()) { for (Container container : testAccount.getAllContainers()) { doPostGetHeadDeleteTest(testAccount, container, testAccount.getName(), container.isPrivate(), testAccount, container); } } doPostGetHeadDeleteTest(null, null, refAccount.getName(), false, refAccount, refDefaultPublicContainer); doPostGetHeadDeleteTest(null, null, refAccount.getName(), true, refAccount, refDefaultPrivateContainer); doPostGetHeadDeleteTest(null, null, "unknown_service_id", false, Account.UNKNOWN_ACCOUNT, Container.DEFAULT_PUBLIC_CONTAINER); doPostGetHeadDeleteTest(null, null, "unknown_service_id", true, Account.UNKNOWN_ACCOUNT, Container.DEFAULT_PRIVATE_CONTAINER); }
Source:
private DefaultOperatorIdGeneratorImpl(@Parameter(OperatorIdPrefix.class) final String prefix) { this.prefix = prefix; operatorIdSeqNum = new AtomicLong(); }

Target:
private DefaultOperatorIdGeneratorImpl(@Parameter(OperatorIdPrefix.class) final String prefix) { this.prefix = prefix; this.operatorIdSeqNum = new AtomicLong(); }
Source:
public static DefaultKfsAccountForAwsResultWrapper generateExpectedDefaultKfsAccountForAwsResultWrapper() { DefaultKfsAccountForAwsResultWrapper defaultKfsAccountForAwsResultWrapper = new DefaultKfsAccountForAwsResultWrapper(); ArrayList<DefaultKfsAccountForAws> defaultKfsAccountForAwsList = new ArrayList<>(); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws("999913976919", "1719999", "2016-04-26 18:43:03")); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws("999970681744", "R999999", "2017-05-26 19:42:23")); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws("999972846379", "R999999", "2016-08-05 04:12:56")); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws("999937185330", "L999999", "2016-04-26 18:43:03")); defaultKfsAccountForAwsResultWrapper.setDefaultKfsAccountsForAws(defaultKfsAccountForAwsList); return defaultKfsAccountForAwsResultWrapper; }

Target:
public static DefaultKfsAccountForAwsResultWrapper generateExpectedDefaultKfsAccountForAwsResultWrapper() { DefaultKfsAccountForAwsResultWrapper defaultKfsAccountForAwsResultWrapper = new DefaultKfsAccountForAwsResultWrapper(); ArrayList<DefaultKfsAccountForAws> defaultKfsAccountForAwsList = new ArrayList<>(); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws(EXPECTED_AWS_ACCOUNTS_VALUES[0], EXPECTED_KFS_DEFAULT_ACCOUNT_VALUES[0], EXPECTED_UPDATED_AT_VALUES[0])); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws(EXPECTED_AWS_ACCOUNTS_VALUES[1], EXPECTED_KFS_DEFAULT_ACCOUNT_VALUES[1], EXPECTED_UPDATED_AT_VALUES[1])); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws(EXPECTED_AWS_ACCOUNTS_VALUES[2], EXPECTED_KFS_DEFAULT_ACCOUNT_VALUES[1], EXPECTED_UPDATED_AT_VALUES[2])); defaultKfsAccountForAwsList.add(buildDefaultKfsAccountForAws(EXPECTED_AWS_ACCOUNTS_VALUES[3], EXPECTED_KFS_DEFAULT_ACCOUNT_VALUES[2], EXPECTED_UPDATED_AT_VALUES[3])); defaultKfsAccountForAwsResultWrapper.setDefaultKfsAccountsForAws(defaultKfsAccountForAwsList); return defaultKfsAccountForAwsResultWrapper; }
Source:
public ByteBuffer makeNewBuffer(long offset) { if (sizeAvailable.addAndGet(-1 * chunkSize) > 0) { return delegate.makeNewBuffer(offset); } else { throw new RuntimeException("No more space left for allocating buffers."); } }

Target:
public ByteBuffer makeNewBuffer(long offset) { if (sizeAvailable.addAndGet(-1 * chunkSize) > 0) { return delegate.makeNewBuffer(offset); } else { sizeAvailable.addAndGet(chunkSize); throw new RuntimeException("No more space left for allocating buffers."); } }
Source:
private void startMachine(String name, DockerContainerConfig containerConfig) throws InfrastructureException { InternalMachineConfig machineCfg = getContext().getMachineConfigs().get(name); Map<String, String> labels = new HashMap<>(containerConfig.getLabels()); labels.putAll(Labels.newSerializer() .machineName(name) .runtimeId(identity) .servers(machineCfg.getServers()) .labels()); containerConfig.setLabels(labels); DockerMachine machine = serviceStarter.startService(dockerEnvironment.getNetwork(), name, containerConfig, identity, devMachineName.equals(name)); try { startSynchronizer.addMachine(name, machine); bootstrapperFactory.create(name, identity, machine, machineCfg.getAgents()).bootstrap(); checkServersReadiness(name, machine); } catch (InfrastructureException e) { destroyMachineQuietly(name, machine); throw e; } }

Target:
private void startMachine(String name, DockerContainerConfig containerConfig) throws InfrastructureException { InternalMachineConfig machineCfg = getContext().getMachineConfigs().get(name); Map<String, String> labels = new HashMap<>(containerConfig.getLabels()); labels.putAll(Labels.newSerializer() .machineName(name) .runtimeId(identity) .servers(machineCfg.getServers()) .labels()); containerConfig.setLabels(labels); DockerMachine machine = serviceStarter.startService(dockerEnvironment.getNetwork(), name, containerConfig, identity, devMachineName.equals(name)); try { startSynchronizer.addMachine(name, machine); bootstrapperFactory.create(name, identity, machine, machineCfg.getInstallers()).bootstrap(); checkServersReadiness(name, machine); } catch (InfrastructureException e) { destroyMachineQuietly(name, machine); throw e; } }
Source:
private Certificate readCertificateFromPemObject(final PemObject pemObject) throws CertificateException { final ByteArrayInputStream bais = new ByteArrayInputStream(pemObject.getContent()); final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509"); return certificateFactory.generateCertificate(bais); }

Target:
private Certificate readCertificateFromPemObject(final PemObject pemObject) throws CertificateException { Preconditions.checkNotNull(pemObject); final ByteArrayInputStream bais = new ByteArrayInputStream(pemObject.getContent()); final CertificateFactory certificateFactory = CertificateFactory.getInstance("X509"); return certificateFactory.generateCertificate(bais); }
Source:
public T findById(final ID id) { T result = null; if (_cache != null) { final Element element = _cache.get(id); if (element == null) { result = lockRow(id, null); } else { result = (T)element.getObjectValue(); } } else { result = lockRow(id, null); } return result }

Target:
public T findById(final ID id) { T result = null; if (_cache != null) { final Element element = _cache.get(id); if (element == null) { result = lockRow(id, null); } else { result = (T)element.getObjectValue(); } } else { result = lockRow(id, null); } return result; }
Source:
public Archive<?> generateDeployment(TestDeployment testDeployment, Collection<ProtocolArchiveProcessor> protocolProcessors) { final Archive<?> appArchive = testDeployment.getApplicationArchive(); if (archiveHolder.getArchive() == null) { try { Collection<Archive<?>> auxArchives = testDeployment.getAuxiliaryArchives(); JavaArchive archive = generateArquillianServiceArchive(auxArchives); Processor processor = new Processor(testDeployment, protocolProcessors); processor.process(archive); archiveHolder.setArchive(archive); } catch (Exception ex) { throw new IllegalStateException("Cannot generate arquillian service", ex); } } addModulesManifestDependencies(appArchive); archiveHolder.addPreparedDeployment(testDeployment.getDeploymentName()); return appArchive; }

Target:
public Archive<?> generateDeployment(TestDeployment testDeployment, Collection<ProtocolArchiveProcessor> protocolProcessors) { final Archive<?> appArchive = testDeployment.getApplicationArchive(); if (archiveHolder.getArchive() == null) { try { Collection<Archive<?>> auxArchives = testDeployment.getAuxiliaryArchives(); JavaArchive archive = generateArquillianServiceArchive(auxArchives); for(ProtocolArchiveProcessor processor : protocolProcessors) { processor.process(testDeployment, archive); } archiveHolder.setArchive(archive); } catch (Exception ex) { throw new IllegalStateException("Cannot generate arquillian service", ex); } } addModulesManifestDependencies(appArchive); archiveHolder.addPreparedDeployment(testDeployment.getDeploymentName()); return appArchive; }
Source:
private static InsecureAlgorithm algorithm(ExpressionTree invocationArgument) { ExpressionTree expectedAlgorithm = invocationArgument; ExpressionTree defaultPropertyValue = JavaPropertiesHelper.retrievedPropertyDefaultValue(invocationArgument); if (defaultPropertyValue != null) { expectedAlgorithm = defaultPropertyValue; } if (expectedAlgorithm.is(Tree.Kind.STRING_LITERAL)) { String algorithmName = LiteralUtils.trimQuotes(((LiteralTree) expectedAlgorithm).value()); return Arrays.stream(InsecureAlgorithm.values()) .filter(alg -> alg.match(algorithmName)) .findFirst().orElse(null); } return null; }

Target:
private static Optional<InsecureAlgorithm> algorithm(ExpressionTree invocationArgument) { ExpressionTree expectedAlgorithm = invocationArgument; ExpressionTree defaultPropertyValue = JavaPropertiesHelper.retrievedPropertyDefaultValue(invocationArgument); if (defaultPropertyValue != null) { expectedAlgorithm = defaultPropertyValue; } if (expectedAlgorithm.is(Tree.Kind.STRING_LITERAL)) { String algorithmName = LiteralUtils.trimQuotes(((LiteralTree) expectedAlgorithm).value()); return Arrays.stream(InsecureAlgorithm.values()) .filter(alg -> alg.match(algorithmName)) .findFirst(); } return Optional.empty(); }
Source:
public static synchronized void initialize(int myHostId, CatalogContext catalogContext, HostMessenger messenger) throws BundleException, IOException { ImporterStatsCollector statsCollector = new ImporterStatsCollector(myHostId); OperationMode startMode = VoltDB.instance().getMode(); ImportManager em = new ImportManager(myHostId, messenger, statsCollector, catalogContext, startMode); VoltDB.instance().getStatsAgent().registerStatsSource( StatsSelector.IMPORTER, myHostId, statsCollector); try { Map<String, ImportConfiguration> newProcessorConfig = em.loadNewConfigAndBundles(); if (em.m_clusterMode != OperationMode.PAUSED) { em.startImporters(newProcessorConfig); } } catch (final Exception e) { VoltDB.crashLocalVoltDB("Error creating initial import processor", true, e); } m_self = em; }

Target:
public static synchronized void initialize(int myHostId, CatalogContext catalogContext, HostMessenger messenger) throws BundleException, IOException { ImporterStatsCollector statsCollector = new ImporterStatsCollector(myHostId); OperationMode startMode = VoltDB.instance().getMode(); ImportManager em = new ImportManager(myHostId, messenger, statsCollector); VoltDB.instance().getStatsAgent().registerStatsSource( StatsSelector.IMPORTER, myHostId, statsCollector); try { Map<String, ImportConfiguration> newProcessorConfig = em.loadNewConfigAndBundles(catalogContext); if (startMode != OperationMode.PAUSED) { em.startImporters(newProcessorConfig); } } catch (final Exception e) { VoltDB.crashLocalVoltDB("Error creating initial import processor", true, e); } m_self = em; }
Source:
public void readGroupList() throws IOException { groupList = GroupList.parse(readUTF8(GroupList.FILE_NAME), this); }

Target:
private void readGroupList() throws IOException { groupList = GroupList.parse(readUTF8(GroupList.FILE_NAME), this); }
Source:
public void createFromEmptyStoreWithNoProjection() throws Exception { URL storeUrl = TestData.url(this, "rgba"); File testDataFolder = new File(storeUrl.toURI()); File testDirectory = crsMosaicFolder.newFolder("rgba_no_proj"); FileUtils.copyDirectory(testDataFolder, testDirectory); for (File file : testDirectory.listFiles(f -> f.getName().startsWith("rgba"))) { file.delete(); } for (File file : testDirectory.listFiles(f -> f.getName().endsWith("prj"))) { file.delete(); } Properties properties = new Properties(); properties.put(Utils.Prop.STORE_NAME, "test"); try (FileOutputStream fos = new FileOutputStream(new File(testDirectory, "datastore.properties"))) { properties.store(fos, null); } properties = new Properties(); properties.put(Utils.Prop.TYPENAME, "abcd"); try (FileOutputStream fos = new FileOutputStream(new File(testDirectory, "indexer.properties"))) { properties.store(fos, null); } DefaultRepository repository = new DefaultRepository(); final Map<String, Serializable> params = Collections.singletonMap( ShapefileDataStoreFactory.URLP.key, URLs.fileToUrl(testDirectory)); DataStore ds = new ShapefileDataStoreFactory().createDataStore(params); assertNotNull(ds); repository.register("test", ds); Hints hints = new Hints(Hints.REPOSITORY, repository); ImageMosaicReader reader = FORMAT.getReader(testDirectory, hints); final File expectedIndexFile = new File(testDirectory, "abcd.shp"); assertTrue( expectedIndexFile.getAbsolutePath() + " does not exist", expectedIndexFile.exists()); assertNotNull(reader); GridCoverage2D coverage = reader.read(NO_DEFERRED_LOAD); assertNotNull(coverage); coverage.dispose(true); reader.dispose(); ds.dispose(); }

Target:
public void createFromEmptyStoreWithNoProjection() throws Exception { URL storeUrl = TestData.url(this, "rgba"); File testDataFolder = new File(storeUrl.toURI()); File testDirectory = crsMosaicFolder.newFolder("rgba_no_proj"); FileUtils.copyDirectory(testDataFolder, testDirectory); for (File file : testDirectory.listFiles(f -> f.getName().startsWith("rgba"))) { file.delete(); } for (File file : testDirectory.listFiles(f -> f.getName().endsWith("prj"))) { file.delete(); } ImageMosaicReader reader = FORMAT.getReader(testDirectory); assertNotNull(reader); GridCoverage2D coverage = reader.read(NO_DEFERRED_LOAD); assertNotNull(coverage); coverage.dispose(true); reader.dispose(); }
Source:
public JavaWriter endType() throws IOException { Scope beginScope = scopes.getFirst(); if (Scope.TYPE_DECLARATION.equals(beginScope)) { popScope(Scope.TYPE_DECLARATION); } else { popScope(Scope.INTERFACE_DECLARATION); } types.pop(); indent(); out.write("}\n"); return this; }

Target:
public JavaWriter endType() throws IOException { popScope(Scope.TYPE_DECLARATION, Scope.INTERFACE_DECLARATION); types.pop(); indent(); out.write("}\n"); return this; }