auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private PatchList readPatchList(final PatchListKey key, final Repository repo) throws IOException { final RevWalk rw = new RevWalk(repo); final RevCommit b = rw.parseCommit(key.getNewId()); final AnyObjectId a = aFor(key, repo, b); if (a == null) { return new PatchList(a, b, computeIntraline, new PatchListEntry[0]); } RevTree aTree = rw.parseTree(a); RevTree bTree = b.getTree(); final TreeWalk walk = new TreeWalk(repo); walk.reset(); walk.setRecursive(true); walk.addTree(aTree); walk.addTree(bTree); walk.setFilter(TreeFilter.ANY_DIFF); ByteArrayOutputStream buf = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buf); while (walk.next()) { outputDiff(ps, walk.getPathString(), walk.getObjectId(0), walk .getFileMode(0), walk.getObjectId(1), walk.getFileMode(1), repo); } org.eclipse.jgit.patch.Patch p = new org.eclipse.jgit.patch.Patch(); p.parse(new ByteArrayInputStream(buf.toByteArray())); final int cnt = p.getFiles().size(); final PatchListEntry[] entries = new PatchListEntry[cnt]; for (int i = 0; i < cnt; i++) { entries[i] = newEntry(repo, aTree, bTree, p.getFiles().get(i)); } return new PatchList(a, b, computeIntraline, entries); }

Target:
private PatchList readPatchList(final PatchListKey key, final Repository repo) throws IOException { final RevWalk rw = new RevWalk(repo); final RevCommit b = rw.parseCommit(key.getNewId()); final AnyObjectId a = aFor(key, repo, b); if (a == null) { return new PatchList(a, b, computeIntraline, new PatchListEntry[0]); } RevTree aTree = rw.parseTree(a); RevTree bTree = b.getTree(); final TreeWalk walk = new TreeWalk(repo); walk.reset(); walk.setRecursive(true); walk.addTree(aTree); walk.addTree(bTree); walk.setFilter(TreeFilter.ANY_DIFF); ByteArrayOutputStream buf = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buf, true, "UTF-8"); while (walk.next()) { outputDiff(ps, walk.getPathString(), walk.getObjectId(0), walk .getFileMode(0), walk.getObjectId(1), walk.getFileMode(1), repo); } org.eclipse.jgit.patch.Patch p = new org.eclipse.jgit.patch.Patch(); ps.flush(); p.parse(new ByteArrayInputStream(buf.toByteArray())); final int cnt = p.getFiles().size(); final PatchListEntry[] entries = new PatchListEntry[cnt]; for (int i = 0; i < cnt; i++) { entries[i] = newEntry(repo, aTree, bTree, p.getFiles().get(i)); } return new PatchList(a, b, computeIntraline, entries); }
Source:
public Mono<DuplexConnection> connect(int mtu) { Mono<DuplexConnection> isError = FragmentationDuplexConnection.checkMtu(mtu); return isError != null ? isError : client .doOnConnected(c -> c.addHandlerLast(new RSocketLengthCodec())) .connect() .map( c -> { if (mtu > 0) { return new FragmentationDuplexConnection( new ReassemblyDuplexConnection( new TcpDuplexConnection(c, false), ByteBufAllocator.DEFAULT, true), ByteBufAllocator.DEFAULT, mtu, true, "client"); } else { return new ReassemblyDuplexConnection( new TcpDuplexConnection(c), ByteBufAllocator.DEFAULT, false); } }); }

Target:
public Mono<DuplexConnection> connect(int mtu) { Mono<DuplexConnection> isError = FragmentationDuplexConnection.checkMtu(mtu); return isError != null ? isError : client .doOnConnected(c -> c.addHandlerLast(new RSocketLengthCodec())) .connect() .map( c -> { if (mtu > 0) { return new FragmentationDuplexConnection( new TcpDuplexConnection(c, false), ByteBufAllocator.DEFAULT, mtu, true, "client"); } else { return new ReassemblyDuplexConnection( new TcpDuplexConnection(c), ByteBufAllocator.DEFAULT, false); } }); }
Source:
public void testAggregateDiskImagesSnapshots() { disk1.setId(Guid.newGuid()); disk1.setActive(true); disk1.setStorageIds(new ArrayList<>()); disk2.setId(disk1.getId()); disk2.setActive(false); disk3.setId(disk1.getId()); disk3.setActive(false); List<DiskImage> disks = new ArrayList<>(); disks.add(disk1); disks.add(disk2); disks.add(disk3); List<DiskImage> result = imagesHandler.aggregateDiskImagesSnapshots(disks) .stream() .map(DiskImage.class::cast) .collect(Collectors.toList()); assertEquals("disk should hold three snapshots", 3, result.get(0).getSnapshots().size()); }

Target:
public void testAggregateDiskImagesSnapshots() { disk1.setId(Guid.newGuid()); disk1.setActive(true); disk1.setStorageIds(new ArrayList<>()); disk2.setId(disk1.getId()); disk2.setActive(false); disk3.setId(disk1.getId()); disk3.setActive(false); DiskImage diskWithoutSnapshots = new DiskImage(); diskWithoutSnapshots.setId(Guid.newGuid()); diskWithoutSnapshots.setActive(true); diskWithoutSnapshots.setStorageIds(new ArrayList<>()); List<DiskImage> result = new ArrayList<>(imagesHandler.aggregateDiskImagesSnapshots(Arrays.asList( disk1, disk2, disk3, diskWithoutSnapshots))); DiskImage resultDisk = result.stream().filter(diskImage -> diskImage.getId() == disk1.getId()).findFirst().orElse(null); assertEquals("wrong number of disks returned", 2, result.size()); assertEquals("wrong number of snapshots for disk1", 3, resultDisk.getSnapshots().size()); }
Source:
public void destroy(int code) { synchronized (lock) { destroyed.set(true); try { if (routeBuilder == null) { return; } for (RouteDefinition routeDef : routeBuilder.getRouteCollection().getRoutes()) { try { String routeId = routeDef.getId(); LOGGER.trace("Stopping route with ID = and path {}", routeId, monitoredDirectory); camelContext.stopRoute(routeId); boolean status = camelContext.removeRoute(routeId); LOGGER.trace("Status of removing route is {}", routeId, status); camelContext.removeRouteDefinition(routeDef); } catch (Exception e) { LOGGER.debug("Unable to stop Camel route with route ID = {}", routeDef.getId(), e); } } } finally { lock.notifyAll(); } } }

Target:
public void destroy(int code) { if (routeBuilder == null) { return; } for (RouteDefinition routeDef : routeBuilder.getRouteCollection().getRoutes()) { try { String routeId = routeDef.getId(); LOGGER.trace("Stopping route with ID = and path {}", routeId, monitoredDirectory); camelContext.stopRoute(routeId); boolean status = camelContext.removeRoute(routeId); LOGGER.trace("Status of removing route is {}", routeId, status); camelContext.removeRouteDefinition(routeDef); } catch (Exception e) { LOGGER.debug("Unable to stop Camel route with route ID = {}", routeDef.getId(), e); } } }
Source:
public ProjectList call() { final ProjectList result = new ProjectList(); List<Project> projects = getProjects(); result.setProjects(projects); result.setCanCreateProject(user.getCapabilities().canCreateProject()); return result; }

Target:
public ProjectList call() { final ProjectList result = new ProjectList(); result.setProjects(getProjects()); result.setCanCreateProject(user.getCapabilities().canCreateProject()); return result; }
Source:
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { Class<? super T> clazz = type.getRawType(); if (clazz == DataCollection.class) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new DataCollectionTypeAdapter<>(getParameterizedTypeAdapter(gson, parameters)); } if (clazz == SizeBatch.class) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new SizeBatchTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz == SizeTimeBatch.class) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new SizeTimeBatchTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz == TimeBatch.class) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new TimeBatchTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz == TagBatch.class) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new TagBatchTypeAdapter(this, getParameterizedTypeAdapter(gson, parameters)); } if (clazz == BatchImpl.class) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new BatchImplTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz == Tag.class) { return (TypeAdapter<T>) getTagTypeAdapter(); } if (clazz == TagData.class) { return (TypeAdapter<T>) new TagDataTypeAdapter(this); } if (clazz == EventData.class) { return (TypeAdapter<T>) new EventDataTypeAdapter(); } return null; }

Target:
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { Class<? super T> clazz = type.getRawType(); if (clazz.isAssignableFrom(DataCollection.class)) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new DataCollectionTypeAdapter<>(getParameterizedTypeAdapter(gson, parameters)); } if (clazz.isAssignableFrom(SizeBatch.class)) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new SizeBatchTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz.isAssignableFrom(SizeTimeBatch.class)) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new SizeTimeBatchTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz.isAssignableFrom(TimeBatch.class)) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new TimeBatchTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz.isAssignableFrom(TagBatch.class)) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new TagBatchTypeAdapter(this, getParameterizedTypeAdapter(gson, parameters)); } if (clazz.isAssignableFrom(BatchImpl.class)) { java.lang.reflect.Type parameters = type.getType(); return (TypeAdapter<T>) new BatchImplTypeAdapter(getParameterizedTypeAdapter(gson, parameters)); } if (clazz.isAssignableFrom(Tag.class)) { return (TypeAdapter<T>) getTagTypeAdapter(); } if (clazz.isAssignableFrom(TagData.class)) { return (TypeAdapter<T>) new TagDataTypeAdapter(this); } if (clazz.isAssignableFrom(EventData.class)) { return (TypeAdapter<T>) new EventDataTypeAdapter(); } return null; }
Source:
private void verifyQueryExecution() { try ( Session session = driver.session() ) { session.readTransaction( (TransactionWork<Void>) tx -> { StatementResult statementResult = tx.run( "MATCH (n) RETURN n.name, n.profession, n.planet, n.city ORDER BY n.name" ); List<String> fields = Arrays.asList( "n.name", "n.profession", "n.planet", "n.city" ); Record amy = statementResult.next(); assertEquals( amy.keys(), fields ); assertPairs( amy.fields(), "n.name", "Amy", "n.profession", "Student", "n.planet", "Mars", "n.city", "null"); Record fry = statementResult.next(); assertEquals( fry.keys(), fields ); assertPairs( fry.fields(), "n.name", "Fry", "n.profession", "Delivery Boy", "n.planet", "Earth", "n.city", "New York"); Record lila = statementResult.next(); assertEquals( lila.keys(), fields ); assertPairs( lila.fields(), "n.name", "Lila", "n.profession", "Pilot", "n.planet", "Earth", "n.city", "New York"); assertFalse( statementResult.hasNext() ); return null; } ); } }

Target:
private void verifyQueryExecution() { try ( Session session = driver.session() ) { session.readTransaction( tx -> { StatementResult statementResult = tx.run( "MATCH (n) RETURN n.name, n.profession, n.planet, n.city ORDER BY n.name" ); List<String> fields = Arrays.asList( "n.name", "n.profession", "n.planet", "n.city" ); Record amy = statementResult.next(); assertEquals( amy.keys(), fields ); assertPairs( amy.fields(), "n.name", "Amy", "n.profession", "Student", "n.planet", "Mars", "n.city", "null"); Record fry = statementResult.next(); assertEquals( fry.keys(), fields ); assertPairs( fry.fields(), "n.name", "Fry", "n.profession", "Delivery Boy", "n.planet", "Earth", "n.city", "New York"); Record lila = statementResult.next(); assertEquals( lila.keys(), fields ); assertPairs( lila.fields(), "n.name", "Lila", "n.profession", "Pilot", "n.planet", "Earth", "n.city", "New York"); assertFalse( statementResult.hasNext() ); return null; } ); } }
Source:
public Mono<Void> bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index) { Assert.notNull(queries, "List of UpdateQuery must not be null"); Assert.notNull(bulkOptions, "BulkOptions must not be null"); return doBulkOperation(queries, bulkOptions, index).then(); }

Target:
public Mono<Void> bulkUpdate(List<UpdateQuery> queries, BulkOptions bulkOptions, IndexCoordinates index) { Assert.notNull(queries, "List of UpdateQuery must not be null"); Assert.notNull(bulkOptions, "BulkOptions must not be null"); Assert.notNull(index, "Index must not be null"); return doBulkOperation(queries, bulkOptions, index).then(); }
Source:
private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = ""; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }

Target:
private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }
Source:
SearchPanel() { final FlowPanel body = new FlowPanel(); initWidget(body); setStyleName(Gerrit.RESOURCES.css().searchPanel()); searchBox = new HintTextBox(); searchBox.setVisibleLength(70); searchBox.setHintText(Gerrit.C.searchHint()); searchBox.setHintStyleName(Gerrit.RESOURCES.css().inputFieldTypeHint()); searchBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { switch (event.getCharCode()) { case KeyCodes.KEY_ENTER: doSearch(); break; case KeyCodes.KEY_ESCAPE: searchBox.setText(""); searchBox.setFocus(false); break; } } }); final Button searchButton = new Button(Gerrit.C.searchButton()); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doSearch(); } }); body.add(searchBox); body.add(searchButton); }

Target:
SearchPanel() { final FlowPanel body = new FlowPanel(); initWidget(body); setStyleName(Gerrit.RESOURCES.css().searchPanel()); searchBox = new HintTextBox(); searchBox.setVisibleLength(70); searchBox.setHintText(Gerrit.C.searchHint()); searchBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { switch (event.getCharCode()) { case KeyCodes.KEY_ENTER: doSearch(); break; case KeyCodes.KEY_ESCAPE: searchBox.setText(""); searchBox.setFocus(false); break; } } }); final Button searchButton = new Button(Gerrit.C.searchButton()); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doSearch(); } }); body.add(searchBox); body.add(searchButton); }
Source:
public int getWorkpiecesSize() { if (this.getWorkpieces() == null) { return 0; } else { return this.getWorkpieces().size(); } }

Target:
public int getWorkpiecesSize() { return this.getWorkpieces().size(); }
Source:
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { if (!isSpringConfigured(beanFactory)) { logger.error("Could not configure Spring Data JPA auditing-feature because the bean " + BEAN_CONFIGURER_ASPECT_BEAN_NAME + " is not present!\n" + "If you want to use auditing please add the @EnableSpringConfigured annotation or\n" + "the <context:spring-configured> element to your configuration."); } }

Target:
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { try { beanFactory.getBeanDefinition(BEAN_CONFIGURER_ASPECT_BEAN_NAME); } catch (NoSuchBeanDefinitionException o_O) { throw new IllegalStateException( "Invalid auditing setup! Make sure you've used @EnableJpaAuditing or <jpa:auditing /> correctly!", o_O); } for (String beanName : getEntityManagerFactoryBeanNames(beanFactory)) { BeanDefinition definition = beanFactory.getBeanDefinition(beanName); definition.setDependsOn(addStringToArray(definition.getDependsOn(), BEAN_CONFIGURER_ASPECT_BEAN_NAME)); } for (String beanName : beanNamesForTypeIncludingAncestors(beanFactory, AuditorAware.class, true, false)) { BeanDefinition definition = beanFactory.getBeanDefinition(beanName); definition.setLazyInit(true); } }
Source:
public String build() { try { return representationBuilder().build().serialize(); } catch (JsonProcessingException e) { e.printStackTrace(); } return null; }

Target:
public String build() { try { return representationBuilder().build().serialize(); } catch (JsonProcessingException e) { LOGGER.error("error occurred while building the HAL resource with navigation links", e); throw new RuntimeException("error occurred while building the HAL resource with navigation links", e); } }
Source:
public List<ICallStackElement> getChildren() { List<ICallStackElement> children = fChildren; if (children == null) { CallStackGroupDescriptor nextLevel = fNextLevel; if (nextLevel == null) { children = Collections.EMPTY_LIST; } else { children = nextLevel.getNextElements(this, fQuark, fSymbolKeyElement, fThreadIdProvider); } fChildren = children; } return children; }

Target:
public List<ICallStackElement> getChildren() { List<ICallStackElement> children = fChildren; if (children == null) { CallStackGroupDescriptor nextGroup = fNextGroup; if (nextGroup == null) { children = Collections.EMPTY_LIST; } else { children = nextGroup.getElements(this, fQuark, fSymbolKeyElement, fThreadIdProvider); } fChildren = children; } return children; }
Source:
public WagedRebalancer(HelixManager helixManager) { _assignmentMetadataStore = new AssignmentMetadataStore(); _rebalanceAlgorithm = ConstraintBasedAlgorithmFactory.getInstance(0, 0); _mappingCalculator = new DelayedAutoRebalancer(); }

Target:
public WagedRebalancer(HelixManager helixManager) { _assignmentMetadataStore = new AssignmentMetadataStore(); _rebalanceAlgorithm = ConstraintBasedAlgorithmFactory.getInstance(); _mappingCalculator = new DelayedAutoRebalancer(); }
Source:
public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) { synchronized (fTraceIndex) { if (fIsIndexing) { return; } fIsIndexing = true; } final Job job = new Job("Indexing " + fTrace.getName() + "...") { @Override protected IStatus run(final IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); while (!monitor.isCanceled()) { try { Thread.sleep(100); setName("Indexing " + fTrace.getName() + " (" + fTrace.getNbEvents() + ")"); monitor.setTaskName(""); } catch (final InterruptedException e) { return Status.OK_STATUS; } } monitor.done(); return Status.OK_STATUS; } }; job.schedule(); fIndexingRequest = new TmfEventRequest(ITmfEvent.class, range, offset, TmfDataRequest.ALL_DATA, fCheckpointInterval, ITmfDataRequest.ExecutionType.BACKGROUND) { @Override public void handleData(final ITmfEvent event) { super.handleData(event); if (event != null) { if ((getNbRead() % fCheckpointInterval) == 0) { updateTraceStatus(); } } } @Override public void handleSuccess() { updateTraceStatus(); } @Override public void handleCompleted() { job.cancel(); super.handleCompleted(); fIsIndexing = false; } private void updateTraceStatus() { if (fTrace.getNbEvents() > 0) { signalNewTimeRange(fTrace.getStartTime(), fTrace.getEndTime()); } } }; fTrace.sendRequest(fIndexingRequest); if (waitForCompletion) { try { fIndexingRequest.waitForCompletion(); } catch (final InterruptedException e) { } } }

Target:
public void buildIndex(final long offset, final TmfTimeRange range, final boolean waitForCompletion) { synchronized (fTraceIndex) { if (fIsIndexing) { return; } fIsIndexing = true; } final Job job = new Job("Indexing " + fTrace.getName() + "...") { @Override protected IStatus run(final IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); while (!monitor.isCanceled()) { try { long prevNbEvents = fTrace.getNbEvents(); Thread.sleep(250); long nbEvents = fTrace.getNbEvents(); setName(Messages.TmfCheckpointIndexer_Indexing + fTrace.getName() + " (" + nbEvents + ")"); long rate = (nbEvents - prevNbEvents) * 4; monitor.setTaskName(rate + Messages.TmfCheckpointIndexer_EventsPerSecond); } catch (final InterruptedException e) { return Status.OK_STATUS; } } monitor.done(); return Status.OK_STATUS; } }; job.schedule(); fIndexingRequest = new TmfEventRequest(ITmfEvent.class, range, offset, TmfDataRequest.ALL_DATA, fCheckpointInterval, ITmfDataRequest.ExecutionType.BACKGROUND) { @Override public void handleData(final ITmfEvent event) { super.handleData(event); if (event != null) { if ((getNbRead() % fCheckpointInterval) == 0) { updateTraceStatus(); } } } @Override public void handleSuccess() { updateTraceStatus(); } @Override public void handleCompleted() { job.cancel(); super.handleCompleted(); fIsIndexing = false; } private void updateTraceStatus() { if (fTrace.getNbEvents() > 0) { signalNewTimeRange(fTrace.getStartTime(), fTrace.getEndTime()); } } }; fTrace.sendRequest(fIndexingRequest); if (waitForCompletion) { try { fIndexingRequest.waitForCompletion(); } catch (final InterruptedException e) { } } }
Source:
protected void writeChildren(URI[] children) { if (children == null || children.length == 0) return; start(CHILDREN_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, children.length); for (URI children1 : children) { writeChild(children1); } end(CHILDREN_ELEMENT); }

Target:
protected void writeChildren(URI[] children) { if (children == null || children.length == 0) return; start(CHILDREN_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, children.length); for (URI child : children) { writeChild(child); } end(CHILDREN_ELEMENT); }
Source:
public void load() throws IOException, ConfigInvalidException { int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { if (oldSnapshot.equals(newSnapshot)) oldSnapshot.setClean(newSnapshot); else snapshot = newSnapshot; } else { final String decoded; if (isUtf8(in)) { decoded = RawParseUtils.decode( RawParseUtils.UTF8_CHARSET, in, 3, in.length); utf8Bom = true; } else { decoded = RawParseUtils.decode(in); } fromText(decoded); snapshot = newSnapshot; hash = newHash; } } catch (FileNotFoundException noFile) { if (configFile.exists()) { throw noFile; } clear(); snapshot = newSnapshot; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retries)), e); } retries++; continue; } final IOException e2 = new IOException(MessageFormat .format(JGitText.get().cannotReadFile, getFile())); e2.initCause(e); throw e2; } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } return; } }

Target:
public void load() throws IOException, ConfigInvalidException { int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { if (oldSnapshot.equals(newSnapshot)) oldSnapshot.setClean(newSnapshot); else snapshot = newSnapshot; } else { final String decoded; if (isUtf8(in)) { decoded = RawParseUtils.decode( RawParseUtils.UTF8_CHARSET, in, 3, in.length); utf8Bom = true; } else { decoded = RawParseUtils.decode(in); } fromText(decoded); snapshot = newSnapshot; hash = newHash; } return; } catch (FileNotFoundException noFile) { if (configFile.exists()) { throw noFile; } clear(); snapshot = newSnapshot; return; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retries)), e); } retries++; continue; } throw new IOException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } } }
Source:
public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); System.out.printf("Key Name : %s%n", keyName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(address.getKeyName()) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().addAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); return null; }

Target:
public Void call() throws Exception { Objects.requireNonNull(acl, "New acl to be added not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureKeyAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); System.out.printf("Key Name : %s%n", keyName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setKeyName(address.getKeyName()) .setResType(OzoneObj.ResourceType.KEY) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().addAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter( JsonUtils.toJsonString("Acl set successfully: " + result))); client.close(); return null; }
Source:
public OAuthTestResourceConfig() { super(); register(AuthResource.class); }

Target:
public OAuthTestResourceConfig() { register(AuthResource.class); }
Source:
public void invalidateVisualState() { if (inputAnchor.hasConnection()) { this.inputType.setText(this.inputAnchor.getStringType()); Optional<GhciSession> ghci = getPane().getGhciSession(); if (ghci.isPresent()) { ListenableFuture<String> result = ghci.get().pull(inputAnchor.getFullExpr()); Futures.addCallback(result, new FutureCallback<String>() { public void onSuccess(String s) { Platform.runLater(() -> setOutput(s)); } public void onFailure(Throwable throwable) { Platform.runLater(() -> setOutput("?!?!?!")); } }); } } else { this.inputType.setText(" ... "); setOutput("??"); } }

Target:
public void invalidateVisualState() { if (inputAnchor.hasConnection()) { this.inputType.setText(this.inputAnchor.getStringType()); Optional<GhciSession> ghci = getPane().getGhciSession(); if (ghci.isPresent()) { ListenableFuture<String> result = ghci.get().pull(inputAnchor.getFullExpr()); Futures.addCallback(result, new FutureCallback<String>() { public void onSuccess(String s) { Platform.runLater(() -> setOutput(s)); } public void onFailure(Throwable throwable) { onSuccess("?!?!?!"); } }); } } else { this.inputType.setText(" ... "); setOutput("??"); } }
Source:
public void setUp() throws Exception { super.setUp(); dao = dbFacade.getEngineSessionDao(); newEngineSession = new EngineSession(); newEngineSession.setEngineSessionId(Guid.newGuid().toString()); newEngineSession.setUserId(Guid.newGuid()); newEngineSession.setRoleIds(new LinkedList<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setGroupIds(new LinkedList<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setUserName(""); existingEngineSession = dao.get(ID); }

Target:
public void setUp() throws Exception { super.setUp(); dao = dbFacade.getEngineSessionDao(); newEngineSession = new EngineSession(); newEngineSession.setEngineSessionId(Guid.newGuid().toString()); newEngineSession.setUserId(Guid.newGuid()); newEngineSession.setRoleIds(new HashSet<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setGroupIds(new HashSet<Guid>(Arrays.asList(FixturesTool.EXISTING_GROUP_ID))); newEngineSession.setUserName(""); existingEngineSession = dao.get(ID); }
Source:
public List<Statement> createNodesStatements() { assertStatementFactoryExists(); Map<String, Set<Node>> newNodesByLabels = groupNodesByLabel(newNodeBuilders); List<Statement> statements = new ArrayList<>(newNodesByLabels.size()); for (Set<Node> nodeModels : newNodesByLabels.values()) { NewNodeEmitter newNodeEmitter = new NewNodeEmitter(nodeModels); Pair<String, Map<String, Object>> emittedCypher = newNodeEmitter.emit(); statements.add(statementFactory.statement(emittedCypher.first, emittedCypher.second)); } return statements; }

Target:
public List<Statement> createNodesStatements() { assertStatementFactoryExists(); Map<String, Set<Node>> newNodesByLabels = groupNodesByLabel(newNodeBuilders); List<Statement> statements = new ArrayList<>(newNodesByLabels.size()); for (Set<Node> nodeModels : newNodesByLabels.values()) { NewNodeStatementBuilder newNodeBuilder = new NewNodeStatementBuilder(nodeModels, statementFactory); statements.add(newNodeBuilder.build()); } return statements; }
Source:
public void enrich(final BatchItem batchItem, final EventType eventType) throws EnrichmentException { try { final JSONObject metadata = batchItem.getEvent().getJSONObject("metadata"); setReceivedAt(metadata); setEventTypeName(metadata, eventType); setFlowId(metadata); setPartiotion(metadata, batchItem); } catch (final JSONException e) { throw new EnrichmentException("enrichment error", e); } }

Target:
public void enrich(final BatchItem batchItem, final EventType eventType) throws EnrichmentException { try { final JSONObject metadata = batchItem.getEvent().getJSONObject("metadata"); setReceivedAt(metadata); setEventTypeName(metadata, eventType); setFlowId(metadata); setPartition(metadata, batchItem); } catch (final JSONException e) { throw new EnrichmentException("enrichment error", e); } }
Source:
protected int getMaxIndexKeys() throws SQLException { if (INDEX_MAX_KEYS == 0) { String sql; if (connection.haveMinimumServerVersion(ServerVersion.v8_0)) { sql = "SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'"; } else { String from; if (connection.haveMinimumServerVersion(ServerVersion.v7_3)) { from = "pg_catalog.pg_namespace n, pg_catalog.pg_type t1, pg_catalog.pg_type t2 WHERE t1.typnamespace=n.oid AND n.nspname='pg_catalog' AND "; } else { from = "pg_type t1, pg_type t2 WHERE "; } sql = "SELECT t1.typlen/t2.typlen FROM " + from + " t1.typelem=t2.oid AND t1.typname='oidvector'"; } Statement stmt = null; try { stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); if (!rs.next()) { stmt.close(); throw new PSQLException( GT.tr( "Unable to determine a value for MaxIndexKeys due to missing system catalog data."), PSQLState.UNEXPECTED_ERROR); } INDEX_MAX_KEYS = rs.getInt(1); } finally { if(stmt != null) { stmt.close(); } } } return INDEX_MAX_KEYS; }

Target:
protected int getMaxIndexKeys() throws SQLException { if (INDEX_MAX_KEYS == 0) { String sql; if (connection.haveMinimumServerVersion(ServerVersion.v8_0)) { sql = "SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'"; } else { String from; if (connection.haveMinimumServerVersion(ServerVersion.v7_3)) { from = "pg_catalog.pg_namespace n, pg_catalog.pg_type t1, pg_catalog.pg_type t2 WHERE t1.typnamespace=n.oid AND n.nspname='pg_catalog' AND "; } else { from = "pg_type t1, pg_type t2 WHERE "; } sql = "SELECT t1.typlen/t2.typlen FROM " + from + " t1.typelem=t2.oid AND t1.typname='oidvector'"; } Statement stmt = null; try { stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); if (!rs.next()) { throw new PSQLException( GT.tr( "Unable to determine a value for MaxIndexKeys due to missing system catalog data."), PSQLState.UNEXPECTED_ERROR); } INDEX_MAX_KEYS = rs.getInt(1); } finally { if (stmt != null) { stmt.close(); } } } return INDEX_MAX_KEYS; }
Source:
public boolean redirectTeleportTo(EntityEnderman entityEnderman, double x, double y, double z) { Sponge.getCauseStackManager().addContext(EventContextKeys.TELEPORT_TYPE, TeleportTypes.ENTITY_TELEPORT); boolean flag = attemptTeleport(x, y, z); Sponge.getCauseStackManager().removeContext(EventContextKeys.TELEPORT_TYPE); return flag; }

Target:
public boolean redirectTeleportTo(EntityEnderman entityEnderman, double x, double y, double z) { try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { frame.addContext(EventContextKeys.TELEPORT_TYPE, TeleportTypes.ENTITY_TELEPORT); return attemptTeleport(x, y, z); } }
Source:
public void migrateExternalIdentifier() throws Exception { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, SUBSTUDY_ID, true)) .thenReturn(Substudy.create()); ExternalIdentifier extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); when(externalIdDao.getExternalId(TestConstants.TEST_STUDY, ID)) .thenReturn(extId); Account account = Account.create(); account.setId(USER_ID); AccountId accountId = AccountId.forExternalId(TestConstants.TEST_STUDY_IDENTIFIER, ID); when(accountDao.getAccount(accountId)).thenReturn(account); externalIdService.migrateExternalIdentifier(study, ID, SUBSTUDY_ID); assertEquals(SUBSTUDY_ID, extId.getSubstudyId()); assertEquals(1, account.getAccountSubstudies().size()); AccountSubstudy acctSubstudy = Iterables.getFirst(account.getAccountSubstudies(), null); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, acctSubstudy.getStudyId()); assertEquals(ID, acctSubstudy.getExternalId()); assertEquals(SUBSTUDY_ID, acctSubstudy.getSubstudyId()); verify(externalIdDao).createExternalId(extId); verify(accountDao).updateAccount(account, null); }

Target:
public void migrateExternalIdentifier() throws Exception { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, SUBSTUDY_ID, true)) .thenReturn(Substudy.create()); ExternalIdentifier extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); when(externalIdDao.getExternalId(TestConstants.TEST_STUDY, ID)) .thenReturn(extId); Account account = Account.create(); account.setId(USER_ID); AccountId accountId = AccountId.forExternalId(TestConstants.TEST_STUDY_IDENTIFIER, ID); when(accountDao.getAccount(accountId)).thenReturn(account); externalIdService.migrateExternalIdentifier(study, ID, SUBSTUDY_ID); assertEquals(SUBSTUDY_ID, extId.getSubstudyId()); assertEquals(1, account.getAccountSubstudies().size()); assertEquals(ID, account.getExternalId()); AccountSubstudy acctSubstudy = Iterables.getFirst(account.getAccountSubstudies(), null); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, acctSubstudy.getStudyId()); assertEquals(ID, acctSubstudy.getExternalId()); assertEquals(SUBSTUDY_ID, acctSubstudy.getSubstudyId()); verify(externalIdDao).createExternalId(extId); verify(accountDao).updateAccount(account, null); }
Source:
public void setup() { NoopApiReporter apiReporter = new NoopApiReporter(); manager = new CoreQueryManager(Features.empty(), async, cluster, parser, queryCache, aggregations, OptionalLimit.empty(), apiReporter); }

Target:
public void setup() { ApiReporter apiReporter = mock(ApiReporter.class); long smallQueryThreshold = 0; manager = new CoreQueryManager(Features.empty(), async, cluster, parser, queryCache, aggregations, OptionalLimit.empty(), smallQueryThreshold, apiReporter); }
Source:
public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException { String cmd = getGDBPath(configuration).toOSString() + " --version"; Process process = null; try { process = ProcessFactory.getFactory().exec(cmd, getLaunchEnvironment(configuration)); String streamOutput = readStreamForVersion(process, true); String gdbVersion = getGDBVersionFromText(streamOutput); if (gdbVersion == null || gdbVersion.isEmpty()) { Exception detailedException = null; if (!streamOutput.isEmpty()) { detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); } else { streamOutput = readStreamForVersion(process, false); if (!streamOutput.isEmpty()) { detailedException = new Exception(streamOutput); } } throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Could not determine GDB version after sending: " + cmd, detailedException)); } return gdbVersion; } catch (IOException e) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error while launching command: " + cmd, e)); } finally { if (process != null) { process.destroy(); } } }

Target:
public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException { String cmd = getGDBPath(configuration).toOSString() + " --version"; Process process = null; Job timeoutJob = null; try { process = ProcessFactory.getFactory().exec(cmd, getLaunchEnvironment(configuration)); final Process finalProc = process; timeoutJob = new Job("GDB version timeout job") { { setSystem(true); } @Override protected IStatus run(IProgressMonitor arg) { finalProc.destroy(); return Status.OK_STATUS; } }; timeoutJob.schedule(10000); String streamOutput = readStream(process.getInputStream()); String gdbVersion = getGDBVersionFromText(streamOutput); if (gdbVersion == null || gdbVersion.isEmpty()) { Exception detailedException = null; if (!streamOutput.isEmpty()) { detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); } else { streamOutput = readStream(process.getErrorStream()); if (!streamOutput.isEmpty()) { detailedException = new Exception(streamOutput); } } throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Could not determine GDB version using command: " + cmd, detailedException)); } return gdbVersion; } catch (IOException e) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error with command: " + cmd, e)); } finally { if (timeoutJob != null) { timeoutJob.cancel(); } if (process != null) { process.destroy(); } } }
Source:
public String extractGender(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7Parser201305Utils.ExtractGender method..."); String genderCode = null; if (CollectionUtils.isNotEmpty(params.getLivingSubjectAdministrativeGender()) && params.getLivingSubjectAdministrativeGender().get(0) != null) { PRPAMT201306UV02LivingSubjectAdministrativeGender gender = params.getLivingSubjectAdministrativeGender() .get(0); if (CollectionUtils.isNotEmpty(gender.getValue()) && gender.getValue().get(0) != null) { CE administrativeGenderCode = gender.getValue().get(0); LOG.info("Found gender in query parameters = " + administrativeGenderCode.getCode()); genderCode = administrativeGenderCode.getCode(); } else { LOG.info("query does not contain a gender code"); } } else { LOG.info("query does not contain a gender code"); } LOG.trace("Exiting HL7Parser201305Utils.ExtractGender method..."); return genderCode; }

Target:
public String extractGender(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7Parser201305Utils.ExtractGender method..."); String genderCode = null; if (CollectionUtils.isNotEmpty(params.getLivingSubjectAdministrativeGender())) { PRPAMT201306UV02LivingSubjectAdministrativeGender gender = params.getLivingSubjectAdministrativeGender() .get(0); if (CollectionUtils.isNotEmpty(gender.getValue()) && gender.getValue().get(0) != null) { CE administrativeGenderCode = gender.getValue().get(0); LOG.info("Found gender in query parameters = ", administrativeGenderCode.getCode()); genderCode = administrativeGenderCode.getCode(); } else { LOG.info("query does not contain a gender code"); } } else { LOG.info("query does not contain a gender code"); } LOG.trace("Exiting HL7Parser201305Utils.ExtractGender method..."); return genderCode; }
Source:
public void testIsInternalClass() { assertTrue(DataTypeUtils.isInternal(DataTypes.INT())); assertTrue(DataTypeUtils.isInternal(DataTypes.INT().notNull().bridgedTo(int.class))); assertTrue(DataTypeUtils.isInternal(DataTypes.ROW().bridgedTo(RowData.class))); assertTrue(DataTypeUtils.isInternal(DataTypes.ROW().bridgedTo(RowData.class))); assertFalse(DataTypeUtils.isInternal(DataTypes.ROW())); }

Target:
public void testIsInternalClass() { assertTrue(DataTypeUtils.isInternal(DataTypes.INT())); assertTrue(DataTypeUtils.isInternal(DataTypes.INT().notNull().bridgedTo(int.class))); assertTrue(DataTypeUtils.isInternal(DataTypes.ROW().bridgedTo(RowData.class))); assertFalse(DataTypeUtils.isInternal(DataTypes.ROW())); }
Source:
protected boolean canDoAction() { boolean retValue = true; if (disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } retValue = retValue && (disk.getDiskStorageType() != DiskStorageType.IMAGE || canRemoveDiskBasedOnImageStorageCheck()); if (retValue) { buildSharedLockMap(); retValue = acquireLockInternal(); } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = true; if (disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } if (retValue) { buildSharedLockMap(); retValue = acquireLockInternal(); } retValue = retValue && (disk.getDiskStorageType() != DiskStorageType.IMAGE || canRemoveDiskBasedOnImageStorageCheck()); return retValue; }
Source:
public void setValue(String str) { this.string = str; }

Target:
public void setValue(String str) { fString = str; }
Source:
private VdcReturnValueBase removeCinderDisk(Guid cinderDiskId, Guid storageDomainId) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, buildChildCommandParameters(cinderDiskId), null, new SubjectEntity(VdcObjectType.Storage, storageDomainId)); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Fail to revert disk id '{}'", cinderDiskId); e.printStackTrace(); return null; } }

Target:
private void removeCinderDisk(Guid cinderDiskId, Guid storageDomainId) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, buildChildCommandParameters(cinderDiskId), null, new SubjectEntity(VdcObjectType.Storage, storageDomainId)); try { future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Fail to revert disk id '{}'.", cinderDiskId); log.error("Exception: ", e); } }
Source:
public ModulePath resolveJsModule( String moduleAddress, String sourcename, int lineno, int colno) { String loadAddress = null; switch (resolutionMode) { case LEGACY: loadAddress = resolveJsModuleFile(moduleAddress); break; case BROWSER: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFile(moduleAddress); } break; case NODE: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFileOrDirectory(moduleAddress); } else { loadAddress = resolveJsModuleFromRegistry(moduleAddress); } break; } if (loadAddress != null) { return new ModulePath(loadAddress); } if (errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, LOAD_WARNING, moduleAddress)); } return null; }

Target:
public ModulePath resolveJsModule( String moduleAddress, String sourcename, int lineno, int colno) { String loadAddress = null; switch (resolutionMode) { case LEGACY: loadAddress = resolveJsModuleLegacy(moduleAddress, sourcename, lineno, colno); break; case BROWSER: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFile(moduleAddress); } break; case NODE: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFileOrDirectory(moduleAddress); } else { loadAddress = resolveJsModuleFromRegistry(moduleAddress); } break; } if (loadAddress != null) { return new ModulePath(loadAddress); } if (errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, LOAD_WARNING, moduleAddress)); } return null; }
Source:
private void setBackgroundImage(Path filepath) { Image image; if (filepath != null && !filepath.toString().isEmpty()) { image = noCatch(() -> new Image(filepath.toUri().toURL().toExternalForm())); mainRoot.setBackground(new Background(new BackgroundImage( image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT ))); } }

Target:
private void setBackgroundImage(Path filepath) { Image image; if (filepath != null && Files.exists(filepath)) { image = noCatch(() -> new Image(filepath.toUri().toURL().toExternalForm())); mainRoot.setBackground(new Background(new BackgroundImage( image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT ))); } else { mainRoot.setBackground(EMPTY); } }
Source:
public void shouldSetTempImagesPathAsCompleteDirectory() { URI path = URI.create("/pages/newImagesTemp/"); ConfigCore.setImagesPath(URI.create("/pages/newImagesTemp/")); System.out.println(ConfigCore.getTempImagesPathAsCompleteDirectory()); assertEquals("Temp images path was set incorrectly!", path, URI.create("/pages/newImagesTemp/")); }

Target:
public void shouldSetTempImagesPathAsCompleteDirectory() { URI path = URI.create("/pages/newImagesTemp/"); ConfigCore.setImagesPath(URI.create("/pages/newImagesTemp/")); assertEquals("Temp images path was set incorrectly!", path, URI.create("/pages/newImagesTemp/")); }
Source:
@Override public RuntimeTestResultSummary runTest( Object objectUnderTest ) { try { hadoopConfigurationBootstrap.getProvider(); String activeConfigurationId = hadoopConfigurationBootstrap.getActiveConfigurationId(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.INFO, messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_DESC, activeConfigurationId ), messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_MESSAGE, activeConfigurationId ), ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( NoShimSpecifiedException e ) { e.printStackTrace(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_NO_SHIM_SPECIFIED_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( ConfigurationException e ) { e.printStackTrace(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_UNABLE_TO_LOAD_SHIM_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } }

Target:
@Override public RuntimeTestResultSummary runTest( Object objectUnderTest ) { try { hadoopConfigurationBootstrap.getProvider(); String activeConfigurationId = hadoopConfigurationBootstrap.getActiveConfigurationId(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.INFO, messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_DESC, activeConfigurationId ), messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_MESSAGE, activeConfigurationId ), ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( NoShimSpecifiedException e ) { return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_NO_SHIM_SPECIFIED_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( ConfigurationException e ) { return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_UNABLE_TO_LOAD_SHIM_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } }