auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static String dotBlockLabel(int blockId, int firstBlockId) { String label = "B" + blockId; String color = ""; if (blockId == 0) { label += " (EXIT)"; color = "red"; } else if (blockId == firstBlockId) { label += " (START)"; color = "green"; } StringBuilder sb = new StringBuilder(); sb.append("[label=\""); sb.append(label); sb.append("\""); if (!color.isEmpty()) { sb.append(",fillcolor=\""); sb.append(color); sb.append("\",fontcolor=\"white\""); } sb.append("]"); return sb.toString(); }

Target:
private static String dotBlockLabel(int blockId, int firstBlockId) { String label = "B" + blockId; String color = ""; if (blockId == 0) { label += " (EXIT)"; color = "red"; } else if (blockId == firstBlockId) { label += " (START)"; color = "green"; } if (!color.isEmpty()) { color = MessageFormat.format(",fillcolor=\"{0}\",fontcolor=\"white\"", color); } return MessageFormat.format(DOT_PADDING + "{0}[label=\"{1}\"{2}];" + NEW_LINE, blockId, label, color); }
Source:
public void apply(EntitySpec<?> entitySpec, String nodeId, ToscaApplication toscaApplication) { final Iterable<String> artifacts = getToscaFacade().getArtifacts(nodeId, toscaApplication); if (Iterables.isEmpty(artifacts)) { return; } final Map<String, String> filesToCopy = MutableMap.of(); for (final String artifactId : artifacts) { Optional<Path> optionalResourcesRootPath = getToscaFacade().getArtifactPath(nodeId, toscaApplication, artifactId); if(!optionalResourcesRootPath.isPresent()) { continue; } BrooklynDslDeferredSupplier deferredRunDir = (BrooklynDslDeferredSupplier) BrooklynDslCommon.formatString("%s/%s", BrooklynDslCommon.attributeWhenReady("install.dir"), artifactId); entitySpec.configure(SoftwareProcess.SHELL_ENVIRONMENT.subKey(artifactId), deferredRunDir); try { Files.walkFileTree(optionalResourcesRootPath.get(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { filesToCopy.put(file.toAbsolutePath().toString(), artifactId + "/" + file.getFileName().toString()); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { LOG.warn("Cannot parse CSAR resources", e); } } entitySpec.configure(SoftwareProcess.PRE_INSTALL_FILES, filesToCopy); }

Target:
public void apply(EntitySpec<?> entitySpec, String nodeId, ToscaApplication toscaApplication) { final Iterable<String> artifacts = getToscaFacade().getArtifacts(nodeId, toscaApplication); if (Iterables.isEmpty(artifacts)) { return; } final Map<String, String> filesToCopy = MutableMap.of(); final String directoryPrefix = Identifiers.makeRandomJavaId(6); for (final String artifactId : artifacts) { Optional<Path> optionalResourcesRootPath = getToscaFacade().getArtifactPath(nodeId, toscaApplication, artifactId); if(!optionalResourcesRootPath.isPresent()) { continue; } BrooklynDslDeferredSupplier deferredInstallDir = (BrooklynDslDeferredSupplier) BrooklynDslCommon.formatString("%s/%s/%s", BrooklynDslCommon.attributeWhenReady("install.dir"), directoryPrefix, artifactId); entitySpec.configure(SoftwareProcess.SHELL_ENVIRONMENT.subKey(artifactId), deferredInstallDir); try { Files.walkFileTree(optionalResourcesRootPath.get(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { filesToCopy.put(file.toAbsolutePath().toString(), String.format("%s/%s/%s", directoryPrefix, artifactId, file.getFileName().toString())); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { LOG.warn("Cannot parse CSAR resources", e); } } entitySpec.configure(SoftwareProcess.PRE_INSTALL_FILES, filesToCopy); }
Source:
private boolean isSet(ReferenceChange diff, boolean mergeRightToLeft) { if (diff.getKind() != DifferenceKind.CHANGE) { return false; } boolean isSet = false; final Match match = diff.getMatch(); final EObject container; if (diff.getSource() == DifferenceSource.LEFT) { container = match.getLeft(); } else { container = match.getRight(); } if (container == null) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (!ReferenceUtil.safeEIsSet(container, diff.getReference())) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (isRejecting(diff, mergeRightToLeft)) { final EObject originContainer; if (match.getComparison().isThreeWay()) { originContainer = match.getOrigin(); } else if (mergeRightToLeft) { originContainer = match.getRight(); } else { originContainer = match.getLeft(); } isSet = originContainer != null && ReferenceUtil.safeEIsSet(originContainer, diff.getReference()); } else { isSet = true; } } } return isSet; }

Target:
private boolean isSet(ReferenceChange diff, boolean mergeRightToLeft) { if (diff.getKind() != DifferenceKind.CHANGE) { return false; } boolean isSet = false; final Match match = diff.getMatch(); final EObject container; if (diff.getSource() == DifferenceSource.LEFT) { container = match.getLeft(); } else { container = match.getRight(); } if (container == null) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (!ReferenceUtil.safeEIsSet(container, diff.getReference())) { isSet = isRejecting(diff, mergeRightToLeft); } else { if (isRejecting(diff, mergeRightToLeft)) { final EObject originContainer; if (match.getComparison().isThreeWay()) { originContainer = match.getOrigin(); } else if (mergeRightToLeft) { originContainer = match.getRight(); } else { originContainer = match.getLeft(); } isSet = originContainer != null && ReferenceUtil.safeEIsSet(originContainer, diff.getReference()); } else { final EObject targetContainer; if (mergeRightToLeft) { targetContainer = match.getLeft(); } else { targetContainer = match.getRight(); } isSet = targetContainer == null || !ReferenceUtil.safeEIsSet(targetContainer, diff.getReference()); } } } return isSet; }
Source:
public void subscriberContextPropagation() throws MuleException { final ContextPropagationChecker contextPropagationChecker = new ContextPropagationChecker(); MessageProcessorChain mp = newChain(empty(), contextPropagationChecker); choiceRouter.addRoute(payloadZapExpression(), mp); initialise(); final CoreEvent result = just(zapEvent()) .transform(choiceRouter) .subscriberContext(contextPropagationChecker.contextPropagationFlag()) .blockFirst(); assertThat(result, not(nullValue())); }

Target:
public void subscriberContextPropagation() throws MuleException { final ContextPropagationChecker contextPropagationChecker = new ContextPropagationChecker(); MessageProcessorChain mp = newChain(empty(), contextPropagationChecker); choiceRouter.addRoute(payloadZapExpression(), mp); initialise(); assertContextPropagation(zapEvent(), choiceRouter, contextPropagationChecker); }
Source:
HashSet<ObjectId> listNonHEADIndexObjects() throws NoWorkTreeException, CorruptObjectException, IOException { RevWalk revWalk = null; DirCache dc = null; if (repo.isBare()) return ((HashSet<ObjectId>) Collections.EMPTY_SET); TreeWalk treeWalk = new TreeWalk(repo); try { dc = repo.readDirCache(); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); HashSet<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (objectId != ObjectId.zeroId()) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }

Target:
HashSet<ObjectId> listNonHEADIndexObjects() throws CorruptObjectException, IOException { RevWalk revWalk = null; DirCache dc = null; try { if (repo.getIndexFile() == null) return ((HashSet<ObjectId>) Collections.EMPTY_SET); } catch (NoWorkTreeException e) { return ((HashSet<ObjectId>) Collections.EMPTY_SET); } TreeWalk treeWalk = new TreeWalk(repo); try { dc = repo.readDirCache(); treeWalk.addTree(new DirCacheIterator(dc)); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); HashSet<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (objectId != ObjectId.zeroId()) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }
Source:
private Resource createNewTemporalResource (final String newName, final InputStream in) { try { this.originalPath = (!this.originalPath.endsWith("/"))? this.originalPath + "/":this.originalPath; final File tempFile = this.dotDavHelper.createTempFile("/" + this.host.getHostname() + this.originalPath + newName); FileUtils.copyStreamToFile(tempFile, in, null); final Resource tempFileResource = new TempFileResourceImpl(tempFile, this.originalPath + newName, this.isAutoPub); return tempFileResource; } catch (Exception e){ Logger.error(this, "Error creating temp file", e); throw new DotRuntimeException(e.getMessage(), e); } }

Target:
private Resource createNewTemporalResource (final String newName, final InputStream in) { try { this.originalPath = (!this.originalPath.endsWith("/"))? this.originalPath + "/":this.originalPath; final File tempFile = this.dotDavHelper.createTempFile("/" + this.host.getHostname() + this.originalPath + newName); FileUtils.copyStreamToFile(tempFile, in, null); final Resource tempFileResource = new TempFileResourceImpl(tempFile, this.originalPath + newName, this.isAutoPub); return tempFileResource; } catch (Exception e){ Logger.debug(this, "Error creating temp file", e); Logger.warn(this, "Error creating temp file", e); throw new DotRuntimeException(e.getMessage(), e); } }
Source:
protected void entryReplaced(long newAddress, long oldAddress) { long oldSize = sizeCalculator.applyAsLong(oldAddress); long newSize = sizeCalculator.applyAsLong(newAddress); lruLock.lock(); try { if (trace) { log.tracef("Replacing LRU node: OldValue: 0x%016x NewValue: 0x%016x", oldAddress, newAddress); } removeNode(oldAddress); addEntryAddressToEnd(newAddress); currentSize += newSize; currentSize -= oldSize; super.entryReplaced(newAddress, oldAddress); } finally { lruLock.unlock(); } }

Target:
protected void entryReplaced(long newAddress, long oldAddress) { long oldSize = sizeCalculator.applyAsLong(oldAddress); long newSize = sizeCalculator.applyAsLong(newAddress); lruLock.lock(); try { removeNode(oldAddress); addEntryAddressToEnd(newAddress); currentSize += newSize; currentSize -= oldSize; super.entryReplaced(newAddress, oldAddress); } finally { lruLock.unlock(); } }
Source:
public GroupIntoToolSectionCommand(ResourceSet set, ToolSection parent, Collection<EObject> selection) { super(set); this.selection = selection; this.parent = parent; }

Target:
public GroupIntoToolSectionCommand(ResourceSet set, ToolSection parent, Collection<EObject> selection) { super(set, parent, selection); }
Source:
private static Integer testDecryption(AccumuloConfiguration conf, byte[] encryptedBytes) throws IOException, AEADBadTagException { CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf); CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf); ByteArrayInputStream decryptedByteStream = new ByteArrayInputStream(encryptedBytes); params.setEncryptedInputStream(decryptedByteStream); params = cryptoModule.getDecryptingInputStream(params); DataInputStream decryptedDataStream = new DataInputStream(params.getPlaintextInputStream()); String utf; Integer in; try { utf = decryptedDataStream.readUTF(); in = decryptedDataStream.readInt(); } catch (IOException e) { final String message = "javax.crypto.AEADBadTagException:"; if (e.getMessage().substring(0, message.length()).equals(message)) { throw new AEADBadTagException(); } else { throw e; } } decryptedDataStream.close(); if (utf.equals(MARKER_STRING) && in.equals(MARKER_INT)) { return 1; } else { return 0; } }

Target:
private static Integer testDecryption(AccumuloConfiguration conf, byte[] encryptedBytes) throws IOException, AEADBadTagException { CryptoModuleParameters params = CryptoModuleFactory.createParamsObjectFromAccumuloConfiguration(conf); CryptoModule cryptoModule = CryptoModuleFactory.getCryptoModule(conf); ByteArrayInputStream decryptedByteStream = new ByteArrayInputStream(encryptedBytes); params.setEncryptedInputStream(decryptedByteStream); params = cryptoModule.getDecryptingInputStream(params); DataInputStream decryptedDataStream = new DataInputStream(params.getPlaintextInputStream()); String utf; Integer in; try { utf = decryptedDataStream.readUTF(); in = decryptedDataStream.readInt(); } catch (IOException e) { if (e.getCause().getClass().equals(AEADBadTagException.class)) { throw new AEADBadTagException(); } else { throw e; } } decryptedDataStream.close(); if (utf.equals(MARKER_STRING) && in.equals(MARKER_INT)) { return 1; } else { return 0; } }
Source:
public <T extends IResource> T create(String kind, String namespace, String name, String subresource, IResource payload) { if(ResourceKind.LIST.equals(kind)) throw new UnsupportedOperationException("Generic create operation not supported for resource type 'List'"); try { namespace = ResourceKind.PROJECT.equals(kind) ? "" : namespace; final URL endpoint = new URLBuilder(this.baseUrl, typeMapper) .kind(kind) .name(name) .namespace(namespace) .subresource(subresource) .build(); String response = client.post(endpoint, IHttpClient.DEFAULT_READ_TIMEOUT, payload); LOGGER.debug(response); return factory.create(response); } catch (HttpClientException e){ throw createOpenShiftException(String.format("Could not create %s resource %s in namespace %s for subresource %s: %s", kind, name, namespace, subresource, e.getMessage()), e); } catch (SocketTimeoutException e) { throw new OpenShiftException(e, "Socket timeout creating resource %s", name); } }

Target:
public <T extends IResource> T create(String kind, String namespace, String name, String subresource, IResource payload) { if(ResourceKind.LIST.equals(kind)) throw new UnsupportedOperationException("Generic create operation not supported for resource type 'List'"); try { namespace = ResourceKind.PROJECT.equals(kind) ? null : namespace; final URL endpoint = new URLBuilder(this.baseUrl, typeMapper) .kind(kind) .name(name) .namespace(namespace) .subresource(subresource) .build(); String response = client.post(endpoint, IHttpClient.DEFAULT_READ_TIMEOUT, payload); LOGGER.debug(response); return factory.create(response); } catch (HttpClientException e){ throw createOpenShiftException(String.format("Could not create %s resource %s in namespace %s for subresource %s: %s", kind, name, namespace, subresource, e.getMessage()), e); } catch (SocketTimeoutException e) { throw new OpenShiftException(e, "Socket timeout creating resource %s", name); } }
Source:
public void put(long bucketId, @NotNull Slice key, @NotNull Slice value) { Map<Slice, Slice> bucket = store.get(bucketId); if (bucket == null) { bucket = Maps.newHashMap(); store.put(bucketId, bucket); } if (key.getClass() == Slice.class) { key = new SerializeSlice(key); } if (value.getClass() == Slice.class) { value = new SerializeSlice(value); } bucket.put(key, value); }

Target:
public void put(long bucketId, @NotNull Slice key, @NotNull Slice value) { Map<Slice, Slice> bucket = store.get(bucketId); if (bucket == null) { bucket = Maps.newHashMap(); store.put(bucketId, bucket); } key = SliceUtils.toBufferSlice(key); value = SliceUtils.toBufferSlice(value); bucket.put(key, value); }
Source:
public void initialize(RoutingRequest request, long abortTime) { Vertex target = request.rctx.target; if (target == this.target) { LOG.debug("Reusing existing heuristic, the target vertex has not changed."); return; } LOG.debug("Initializing heuristic computation."); this.graph = request.rctx.graph; long start = System.currentTimeMillis(); this.target = target; this.routingRequest = request; request.softWalkLimiting = false; request.softPreTransitLimiting = false; request.bikeWalkingOptions.softWalkLimiting = false; request.bikeWalkingOptions.softPreTransitLimiting = false; transitQueue = new BinHeap<>(); TObjectDoubleMap<Vertex> forwardStreetSearchResults = streetSearch(request, false, abortTime); if (forwardStreetSearchResults == null) { return; } preTransitVertices = forwardStreetSearchResults.keySet(); LOG.debug("end forward street search ms", System.currentTimeMillis() - start); postBoardingWeights = streetSearch(request, true, abortTime); if (postBoardingWeights == null) { return; } LOG.debug("end backward street search ms", System.currentTimeMillis() - start); if (!request.modes.getCar()) request.setMaxWalkDistance(Double.POSITIVE_INFINITY); request.setMaxPreTransitTime(Integer.MAX_VALUE); LOG.debug("initialized SSSP"); request.rctx.debugOutput.finishedPrecalculating(); }

Target:
public void initialize(RoutingRequest request, long abortTime) { Vertex target = request.rctx.target; if (target == this.target) { LOG.debug("Reusing existing heuristic, the target vertex has not changed."); return; } LOG.debug("Initializing heuristic computation."); this.graph = request.rctx.graph; long start = System.currentTimeMillis(); this.target = target; this.routingRequest = request; request.softWalkLimiting = false; request.softPreTransitLimiting = false; request.bikeWalkingOptions.softWalkLimiting = false; request.bikeWalkingOptions.softPreTransitLimiting = false; transitQueue = new BinHeap<>(); preTransitVertices = streetSearch(request, false, abortTime); if (preTransitVertices == null) { return; } LOG.debug("end forward street search ms", System.currentTimeMillis() - start); postTransitVertices = streetSearch(request, true, abortTime); if (postTransitVertices == null) { return; } LOG.debug("end backward street search ms", System.currentTimeMillis() - start); transitVertexWeights = new TObjectDoubleHashMap<>(100, 0.5f, Double.POSITIVE_INFINITY); remainingDistanceSpeed = request.getStreetSpeedUpperBound(); preTransitRemainingWeightEstimates = new HashMap<>(); useEuclideanRemainingWeightEstimateForPreTransitVertices = request.modes.getCar() || ( request.modes.getBicycle() && request.maxWalkDistance > PRE_TRANSIT_EUCLIDEAN_WALK_DISTANCE_THRESHOLD ); request.setMaxWalkDistance(Double.POSITIVE_INFINITY); request.setMaxPreTransitTime(Integer.MAX_VALUE); LOG.debug("initialized SSSP"); request.rctx.debugOutput.finishedPrecalculating(); }
Source:
public AnnualCreditsState(ExecutionYear executionYear) { super(); setExecutionYear(executionYear); setOrientationsCalculationDate(new LocalDate(executionYear.getBeginCivilYear(), 12, 31)); setIsOrientationsCalculated(false); setIsFinalCreditsCalculated(false); setIsCreditsClosed(false); setRootDomainObject(Bennu.getInstance()); }

Target:
public AnnualCreditsState(ExecutionYear executionYear) { super(); setExecutionYear(executionYear); setOrientationsCalculationDate(new LocalDate(executionYear.getBeginCivilYear(), 12, 31)); setIsOrientationsCalculated(false); setIsFinalCreditsCalculated(false); setIsCreditsClosed(false); setCreationDate(new DateTime()); setRootDomainObject(Bennu.getInstance()); }
Source:
private List<GerritQueryResult> executeQueryRest(String query) throws GerritException { List<GerritQueryResult> results = null; results = client.executeQueryRest(new NullProgressMonitor(), query); return results; }

Target:
private List<GerritQueryResult> executeQueryRest(String query) throws GerritException { return client.executeQueryRest(new NullProgressMonitor(), query); }
Source:
public void sendMessage(byte[] data) { try { output.write(data); output.flush(); } catch (IOException ioException) { logger.debug("sendMessage(): Writing error: {}", ioException.getMessage()); connected = false; } catch (Exception exception) { logger.debug("sendMessage(): Writing error: {}", exception.getMessage()); connected = false; } }

Target:
public void sendMessage(byte[] data) { try { output.write(data); output.flush(); } catch (IOException ioException) { logger.debug("sendMessage(): Writing error: {}", ioException.getMessage()); setConnected(false); } catch (Exception exception) { logger.debug("sendMessage(): Writing error: {}", exception.getMessage()); setConnected(false); } }
Source:
public void whenMediaFolderFileDoesNotExist_shouldGetAllMethodReturnEmptyArray() { FormsDao formsDao = mock(FormsDao.class); FileUtil fileUtil = mock(FileUtil.class); File file = mock(File.class); String formMediaPath = "/samplePath/"; when(formsDao.getFormMediaPath("1", "1")).thenReturn(formMediaPath); when(fileUtil.getFileAtPath(formMediaPath)).thenReturn(file); when(file.exists()).thenReturn(false); assertThat(new DatabaseMediaFileRepository(formsDao, new FileUtil()).getAll("1", "1").size(), is(0)); }

Target:
public void whenMediaFolderFileDoesNotExist_shouldGetAllMethodReturnEmptyArray() { FormsDao formsDao = mock(FormsDao.class); when(formsDao.getFormMediaPath("1", "1")).thenReturn("/samplePath/"); assertThat(new DatabaseMediaFileRepository(formsDao, new FileUtil()).getAll("1", "1").size(), is(0)); }
Source:
public List<ResolvedTypeParameterDeclaration> getTypeParameters() { if (null == ctClass.getGenericSignature()) { return new ArrayList<>(); } else { try { SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return Arrays.<SignatureAttribute.TypeParameter>stream(classSignature.getParameters()) .map((tp) -> new JavassistTypeParameter(tp, JavassistFactory.toTypeDeclaration(ctClass, typeSolver), typeSolver)) .collect(Collectors.toList()); } catch (BadBytecode badBytecode) { throw new RuntimeException(badBytecode); } } }

Target:
public List<ResolvedTypeParameterDeclaration> getTypeParameters() { if (null == ctClass.getGenericSignature()) { return Collections.emptyList(); } else { try { SignatureAttribute.ClassSignature classSignature = SignatureAttribute.toClassSignature(ctClass.getGenericSignature()); return Arrays.<SignatureAttribute.TypeParameter>stream(classSignature.getParameters()) .map((tp) -> new JavassistTypeParameter(tp, JavassistFactory.toTypeDeclaration(ctClass, typeSolver), typeSolver)) .collect(Collectors.toList()); } catch (BadBytecode badBytecode) { throw new RuntimeException(badBytecode); } } }
Source:
private void stagePathConfiguration(Configuration config) { File depFH = new VoltFile(config.m_voltdbRoot, VoltDB.INITIALIZED_PATHS); try (PrintWriter pw = new PrintWriter(new FileWriter(depFH), true)) { m_pathList.store(pw, "DO NOT MODIFY THIS FILE"); pw.flush(); pw.close(); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to stage configuration path destination", false, e); } }

Target:
private void stagePathConfiguration(Configuration config) { File depFH = new VoltFile(config.m_voltdbRoot, VoltDB.INITIALIZED_PATHS); try (PrintWriter pw = new PrintWriter(new FileWriter(depFH), true)) { m_pathList.store(pw, "DO NOT MODIFY THIS FILE"); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to stage configuration path destination", false, e); } }
Source:
public void setCurrentPacket(ICTFPacketDescriptor currentPacket) throws CTFException { fCurrentPacket = currentPacket; if (fCurrentPacket != null) { ByteBuffer bb = null; try { bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { throw new CTFIOException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); fBitBuffer = bitBuffer; if (fTracePacketHeaderDecl != null) { fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer); } if (fStreamPacketContextDecl != null) { fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer); if (getCurrentPacket().getTarget() != null) { fCurrentCpu = (int) getCurrentPacket().getTargetId(); } fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); if (fLostEventsInThisPacket != 0) { fHasLost = true; } } fLastTimestamp = Math.max(currentPacket.getTimestampBegin(),fLastTimestamp); } else { fBitBuffer = null; fLastTimestamp = 0; } }

Target:
public void setCurrentPacket(ICTFPacketDescriptor currentPacket) throws CTFException { fCurrentPacket = currentPacket; if (fCurrentPacket != null) { ByteBuffer bb = null; try { bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { throw new CTFIOException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); fBitBuffer = bitBuffer; if (fTracePacketHeaderDecl != null) { fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer); } if (fStreamPacketContextDecl != null) { fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer); if (getCurrentPacket().getTarget() != null) { fCurrentCpu = (int) getCurrentPacket().getTargetId(); } fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents(); if (fLostEventsInThisPacket != 0) { fHasLost = true; } } fLastTimestamp = Math.max(currentPacket.getTimestampBegin(),0); } else { fBitBuffer = null; fLastTimestamp = 0; } }
Source:
static ExternalIdentifier create(StudyIdentifier studyId, String identifier) { return new DynamoExternalIdentifier(studyId == null ? null : studyId.getIdentifier(), identifier); }

Target:
static ExternalIdentifier create(StudyIdentifier studyId, String identifier) { checkNotNull(studyId); return new DynamoExternalIdentifier(studyId.getIdentifier(), identifier); }
Source:
public void waitForAllocate() { try { if (this.instance != null) { instance = context.resourceMonitor.waitFor(instance, new ResourcePredicate<Instance>() { @Override public boolean evaluate(Instance obj) { return context.objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()).size() > 0; } }); } } catch (Exception ex) { throw new ServiceInstanceAllocateException("Failed to allocate instance [" + instance.getId() + "]"); } }

Target:
public void waitForAllocate() { try { if (this.instance != null) { instance = context.resourceMonitor.waitFor(instance, new ResourcePredicate<Instance>() { @Override public boolean evaluate(Instance obj) { return context.objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()).size() > 0; } }); } } catch (Exception ex) { throw new ServiceInstanceAllocateException("Failed to allocate instance [" + instance.getId() + "]", ex); } }
Source:
void setIsEmptyDirectory(Tristate isEmptyDirectory) { this.isEmptyDirectory = isEmptyDirectory; if (fileStatus.isDirectory()) { fileStatus = new S3AFileStatus( isEmptyDirectory, fileStatus.getPath(), fileStatus.getOwner()); } }

Target:
void setIsEmptyDirectory(Tristate isEmptyDirectory) { this.isEmptyDirectory = isEmptyDirectory; fileStatus.setIsEmptyDirectory(isEmptyDirectory); }
Source:
public void aiMover() { this.players = this.level.getPlayers(); this.units = this.level.getUnits(); this.enemies.addAll(units.stream().filter( u -> u instanceof Enemy).map( u -> (Enemy) u).collect(Collectors.toList())); if(players.size() > 0) { this.player = this.players.get(0); for(int i = 0; i < enemies.size(); i++) { Enemy enemy = enemies.get(i); enemy.setPlayer((Mover) player); int moveToX = PathCalculation.calculateXPath((Mover) player, enemy); int moveToY = PathCalculation.calculateYPath((Mover) player, enemy); randomize(enemy); doMoves(enemy, moveToX, moveToY); } } }

Target:
public void aiMover() { this.players = this.level.getPlayers(); this.units = this.level.getUnits(); this.enemies.addAll(units.stream().filter( u -> u instanceof Enemy).map( u -> (Enemy) u).collect(Collectors.toList())); if(players.size() > 0) { this.player = this.players.get(0); for(int i = 0; i < enemies.size(); i++) { Enemy enemy = enemies.get(i); enemy.setPlayer((Player) player); int moveToX = PathCalculation.calculateXPath((Mover) player, enemy); int moveToY = PathCalculation.calculateYPath((Mover) player, enemy); randomize(enemy); doMoves(enemy, moveToX, moveToY); } } }
Source:
public void removeConnectionCallbacks(LostApiClient.ConnectionCallbacks callbacks) { serviceConnectionManager.removeCallbacks(callbacks); }

Target:
void removeConnectionCallbacks(LostApiClient.ConnectionCallbacks callbacks) { serviceConnectionManager.removeCallbacks(callbacks); }
Source:
public void interfaceStaticMethods() throws Exception { assumeTrue(isJava8()); TypeSpec bar = TypeSpec.interfaceBuilder("Tacos") .addMethod(MethodSpec.methodBuilder("test") .addModifiers(Modifier.PUBLIC, Modifier.valueOf("STATIC")) .returns(int.class) .addCode(CodeBlock.builder().addStatement("return 0").build()) .build()) .build(); assertThat(toString(bar)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "interface Tacos {\n" + " static int test() {\n" + " return 0;\n" + " }\n" + "}\n" ); }

Target:
public void interfaceStaticMethods() throws Exception { TypeSpec bar = TypeSpec.interfaceBuilder("Tacos") .addMethod(MethodSpec.methodBuilder("test") .addModifiers(Modifier.PUBLIC, Modifier.STATIC) .returns(int.class) .addCode(CodeBlock.builder().addStatement("return 0").build()) .build()) .build(); assertThat(toString(bar)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "interface Tacos {\n" + " static int test() {\n" + " return 0;\n" + " }\n" + "}\n" ); }
Source:
public void execute(String[] args, Console console) { String subCommand = args[0]; if (SUBCMD_DUMP.equals(subCommand) || args.length > 2) { switch (subCommand) { case SUBCMD_DUMP: dumpMetadata(console); break; case SUBCMD_LIST: listMetadata(console, args[1], args[2]); break; case SUBCMD_ADD: if (args.length < 4) { printUsage(console); } else { addMetadata(console, args[1], args[2], args[3], args.length > 4 ? args[4] : null); } break; case SUBCMD_REMOVE: removeMetadata(console, args[1], args[2]); break; default: console.println("Unknown command '" + subCommand + "'"); printUsage(console); break; } } else { printUsage(console); } }

Target:
public void execute(String[] args, Console console) { if (args.length > 0) { String subCommand = args[0]; switch (subCommand) { case SUBCMD_LIST: listMetadata(console, args.length > 1 ? args[1] : null, args.length > 2 ? args[2] : null, false); break; case SUBCMD_LIST_INTERNAL: listMetadata(console, args.length > 1 ? args[1] : null, args.length > 2 ? args[2] : null, true); break; case SUBCMD_ADD: if (args.length < 4) { printUsage(console); } else { addMetadata(console, args[1], args[2], args[3], args.length > 4 ? args[4] : null); } break; case SUBCMD_REMOVE: removeMetadata(console, args[1], args.length > 2 ? args[2] : null); break; default: console.println("Unknown command '" + subCommand + "'"); printUsage(console); break; } } else { printUsage(console); } }
Source:
public Response approve(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("thingUID") @ApiParam(value = "thingUID", required = true) String thingUID, @ApiParam(value = "thing label") String label) { ThingUID thingUIDObject = new ThingUID(thingUID); String notEmptyLabel = label != null && !label.isEmpty() ? label : null; Thing thing = null; try { thing = inbox.approve(thingUIDObject, notEmptyLabel); } catch (IllegalArgumentException e) { logger.error("Thing unable to be approved: {}", thingUID, e.getLocalizedMessage()); return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Thing unable to be approved: " + e.getLocalizedMessage()); } if (thing == null) { return JSONResponse.createErrorResponse(Status.CONFLICT, "No binding found that can create the thing"); } return Response.ok(null, MediaType.TEXT_PLAIN).build(); }

Target:
public Response approve(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("thingUID") @ApiParam(value = "thingUID", required = true) String thingUID, @ApiParam(value = "thing label") String label) { ThingUID thingUIDObject = new ThingUID(thingUID); String notEmptyLabel = label != null && !label.isEmpty() ? label : null; Thing thing = null; try { thing = inbox.approve(thingUIDObject, notEmptyLabel); } catch (IllegalArgumentException e) { logger.error("Thing unable to be approved: {}", thingUID, e.getLocalizedMessage()); return JSONResponse.createErrorResponse(Status.NOT_FOUND, "Thing unable to be approved."); } if (thing == null) { return JSONResponse.createErrorResponse(Status.CONFLICT, "No binding found that can create the thing"); } return Response.ok(null, MediaType.TEXT_PLAIN).build(); }
Source:
public void checkCidrValidation() { boolean result = CidrValidator.isCidrFormatValid(cidr); if (result) { assertEquals(expectedResult, CidrValidator.isCidrValidNetworkAddress(cidr)); } else { assertEquals(expectedResult, CidrValidator.isCidrFormatValid(cidr)); } }

Target:
public void checkCidrValidation() { boolean result = CidrValidator.isCidrFormatValid(cidr); if (result) { assertEquals(expectedResult, CidrValidator.isCidrNetworkAddressValid(cidr)); } else { assertEquals(expectedResult, CidrValidator.isCidrFormatValid(cidr)); } }
Source:
public TestRecord(final ConsumerRecord<K, V> record) { this(record.key(), record.value(), record.headers(), record.timestamp()); }

Target:
public TestRecord(final ConsumerRecord<K, V> record) { Objects.requireNonNull(record); this.key = record.key(); this.value = record.value(); this.headers = record.headers(); this.recordTime = Instant.ofEpochMilli(record.timestamp()); }
Source:
private void updatePlan(final RefreshRequest request, IBuildPlan oldPlan, IBuildPlan newPlan, final IOperationMonitor monitor, Date refreshDate) { if (newPlan != null) { newPlan.setRefreshDate(refreshDate); update(request, oldPlan, (BuildPlan) newPlan, monitor); } else { String message; if (oldPlan.getParent() == null) { message = "The plan does not exist."; } else { message = "The child plan does not exist."; } ((BuildPlan) oldPlan).setOperationStatus(new Status(IStatus.ERROR, BuildsCorePlugin.ID_PLUGIN, message)); } }

Target:
private void updatePlan(final RefreshRequest request, IBuildPlan oldPlan, IBuildPlan newPlan, final IOperationMonitor monitor, Date refreshDate) { if (newPlan != null) { newPlan.setRefreshDate(refreshDate); update(request, oldPlan, (BuildPlan) newPlan, monitor); } else { String message; if (oldPlan.getParent() == null) { message = String.format("The plan %s does not exist.", oldPlan.getId()); } else { message = String.format("The child plan %s does not exist.", oldPlan.getId()); } ((BuildPlan) oldPlan).setOperationStatus(new Status(IStatus.ERROR, BuildsCorePlugin.ID_PLUGIN, message)); } }
Source:
public void testGetIntentForBrokerActivityEmptyIntent() throws NameNotFoundException, OperationCanceledException, IOException, AuthenticatorException { final AuthenticationRequest authRequest = createAuthenticationRequest("<LINK_0>", "resource", "client", "redirect", "loginhint", PromptBehavior.Auto, "", UUID.randomUUID(), false); final AccountManager mockAcctManager = getMockedAccountManager(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE, AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME); Bundle expected = new Bundle(); prepareAddAccount(mockAcctManager, expected); final FileMockContext context = new FileMockContext(InstrumentationRegistry.getContext()); context.setMockedAccountManager(mockAcctManager); context.setMockedPackageManager(getMockedPackageManagerWithBrokerAccountServiceDisabled(mock(Signature.class), AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME, true)); final BrokerProxy brokerProxy = new BrokerProxy(context); try { final Intent intent = brokerProxy.getIntentForBrokerActivity(authRequest, null); assertNull("Intent is null", intent); } catch (final AuthenticationException exc) { fail("Not expected."); } }

Target:
public void testGetIntentForBrokerActivityEmptyIntent() throws NameNotFoundException, OperationCanceledException, IOException, AuthenticatorException, AuthenticationException { final AuthenticationRequest authRequest = createAuthenticationRequest("<LINK_0>", "resource", "client", "redirect", "loginhint", PromptBehavior.Auto, "", UUID.randomUUID(), false); final AccountManager mockAcctManager = getMockedAccountManager(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE, AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME); Bundle expected = new Bundle(); prepareAddAccount(mockAcctManager, expected); final FileMockContext context = new FileMockContext(InstrumentationRegistry.getContext()); context.setMockedAccountManager(mockAcctManager); context.setMockedPackageManager(getMockedPackageManagerWithBrokerAccountServiceDisabled(mock(Signature.class), AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME, true)); final BrokerProxy brokerProxy = new BrokerProxy(context); final Intent intent = brokerProxy.getIntentForBrokerActivity(authRequest, null); assertNull("Intent is null", intent); }
Source:
public void testThrowExceptionOnNonexistingAttribute() { RequirementMatcher matcher = new RequirementMatcher(ComplexReq.class, new RequirementVersionMatcher("noConfig.version", ">1.0")); matcher.matches(complexConfig); }

Target:
public void testThrowExceptionOnNonexistingAttribute() { RequirementMatcher matcher = new RequirementMatcher(ComplexReq.class, "noConfig.version", new VersionMatcher(">1.0")); matcher.matches(complexConfig); }
Source:
public void testExists() throws IOException { String path = "/path"; Assert.assertFalse(_testBaseDataAccessor.exists(path, AccessOption.PERSISTENT)); Map<String, Boolean> result; String data = new JerseyUriRequestBuilder("zookeeper{}?command=exists").format(path) .isBodyReturnExpected(true).get(this); result = OBJECT_MAPPER.readValue(data, HashMap.class); Assert.assertTrue(result.containsKey("exists")); Assert.assertEquals(result.get("exists"), Boolean.FALSE); String content = "testExists"; Assert.assertTrue( _testBaseDataAccessor.create(path, content.getBytes(), AccessOption.PERSISTENT)); Assert.assertTrue(_testBaseDataAccessor.exists(path, AccessOption.PERSISTENT)); data = new JerseyUriRequestBuilder("zookeeper{}?command=exists").format(path) .isBodyReturnExpected(true).get(this); result = OBJECT_MAPPER.readValue(data, HashMap.class); Assert.assertTrue(result.containsKey("exists")); Assert.assertEquals(result.get("exists"), Boolean.TRUE); _testBaseDataAccessor.remove(path, AccessOption.PERSISTENT); }

Target:
public void testExists() throws IOException { String path = "/path"; Assert.assertFalse(_testBaseDataAccessor.exists(path, AccessOption.PERSISTENT)); Map<String, Boolean> result; String data = new JerseyUriRequestBuilder("zookeeper{}?command=exists").format(path) .isBodyReturnExpected(true).get(this); result = OBJECT_MAPPER.readValue(data, HashMap.class); Assert.assertTrue(result.containsKey("exists")); Assert.assertFalse(result.get("exists")); String content = "testExists"; Assert.assertTrue( _testBaseDataAccessor.create(path, content.getBytes(), AccessOption.PERSISTENT)); Assert.assertTrue(_testBaseDataAccessor.exists(path, AccessOption.PERSISTENT)); data = new JerseyUriRequestBuilder("zookeeper{}?command=exists").format(path) .isBodyReturnExpected(true).get(this); result = OBJECT_MAPPER.readValue(data, HashMap.class); Assert.assertTrue(result.containsKey("exists")); Assert.assertTrue(result.get("exists")); _testBaseDataAccessor.remove(path, AccessOption.PERSISTENT); }
Source:
public String getName() { AppInstanceStatusResource instance = this.instances.iterator().next(); return (instance != null && instance.getAttributes() != null) ? instance.getAttributes().get("skipper.application.name") : "no-instances"; }

Target:
public String getName() { AppInstanceStatusResource instance = this.instances.iterator().next(); return (instance != null && instance.getAttributes() != null) ? instance.getAttributes().get(StreamRuntimePropertyKeys.ATTRIBUTE_SKIPPER_APPLICATION_NAME) : NO_INSTANCES; }
Source:
public List<AppConfigElement> getMostRecentElements(StudyIdentifier studyId, boolean includeDeleted) { DynamoAppConfigElement key = new DynamoAppConfigElement(); key.setStudyId(studyId.getIdentifier()); List<DynamoAppConfigElement> elements = indexHelper.queryKeys(DynamoAppConfigElement.class, "studyId", studyId.getIdentifier(), null); Map<String,Long> versionMap = Maps.newHashMap(); for (DynamoAppConfigElement oneElement : elements) { if (includeDeleted || !oneElement.isDeleted()) { String elementKey = studyId.getIdentifier() + ":" + oneElement.getId(); Long existingRevision = versionMap.get(elementKey); if (existingRevision == null || oneElement.getRevision() > existingRevision) { versionMap.put(elementKey, oneElement.getRevision()); } } } List<AppConfigElement> mostRecentElements = Lists.newArrayListWithCapacity(versionMap.size()); for (Map.Entry<String,Long> entry : versionMap.entrySet()) { DynamoAppConfigElement oneKey = new DynamoAppConfigElement(); oneKey.setKey(entry.getKey()); oneKey.setRevision(entry.getValue()); DynamoAppConfigElement appConfigElement = mapper.load(oneKey); mostRecentElements.add(appConfigElement); } return mostRecentElements; }

Target:
public List<AppConfigElement> getMostRecentElements(StudyIdentifier studyId, boolean includeDeleted) { DynamoAppConfigElement key = new DynamoAppConfigElement(); key.setStudyId(studyId.getIdentifier()); DynamoDBQueryExpression<DynamoAppConfigElement> query = new DynamoDBQueryExpression<DynamoAppConfigElement>() .withIndexName(STUDY_ID_INDEX_NAME) .withHashKeyValues(key) .withConsistentRead(false) .withScanIndexForward(false); List<DynamoAppConfigElement> elementIndices = mapper.query(DynamoAppConfigElement.class, query); Map<String,AppConfigElement> versionMap = Maps.newHashMap(); Map<String, List<Object>> resultMap = mapper.batchLoad(elementIndices); for (List<Object> resultList : resultMap.values()) { for (Object oneResult : resultList) { if (!(oneResult instanceof DynamoAppConfigElement)) { throw new BridgeServiceException("DynamoDB returned objects of type " + oneResult.getClass().getName() + " instead of DynamoAppConfigElement"); } DynamoAppConfigElement oneElement = (DynamoAppConfigElement)oneResult; if (!includeDeleted && oneElement.isDeleted()) { continue; } AppConfigElement existingElement = versionMap.get(oneElement.getId()); Long existingRevision = (existingElement == null) ? null : existingElement.getRevision(); if (existingRevision == null || oneElement.getRevision() > existingRevision) { versionMap.put(oneElement.getId(), oneElement); } } } List<AppConfigElement> elements = Lists.newArrayList(versionMap.values()); Collections.sort(elements, Comparator.comparing(AppConfigElement::getId)); return elements; }
Source:
public static OfflineUserRestore buildInMemoryUserRestore(InputStream restoreStream) throws IOException { OfflineUserRestore offlineUserRestore = new OfflineUserRestore(); offlineUserRestore.restore = new String(StreamsUtil.inputStreamToByteArray(restoreStream)); return offlineUserRestore; }

Target:
public static OfflineUserRestore buildInMemoryUserRestore(InputStream restoreStream) throws UnfullfilledRequirementsException, IOException, InvalidStructureException, XmlPullParserException { OfflineUserRestore offlineUserRestore = new OfflineUserRestore(); byte[] restoreBytes = StreamsUtil.inputStreamToByteArray(restoreStream); offlineUserRestore.restore = new String(restoreBytes); offlineUserRestore.checkThatRestoreIsValid(); offlineUserRestore.password = PropertyUtils.genUUID(); return offlineUserRestore; }
Source:
public void shouldUpdatePersonWithGivenParameters() { Person person = createTestPerson(); Person.Address personAddress = person.getPreferredAddress(); openMRSActionProxyService.updatePerson(person.getUuid(), person.getPreferredName().getGivenName(), person.getPreferredName().getMiddleName(), person.getPreferredName().getFamilyName(), personAddress.getAddress1(), personAddress.getAddress2(), personAddress.getAddress3(), personAddress.getAddress4(), personAddress.getAddress5(), personAddress.getAddress6(), personAddress.getCityVillage(), personAddress.getStateProvince(), personAddress.getCountry(), personAddress.getPostalCode(), personAddress.getCountyDistrict(), personAddress.getLatitude(), personAddress.getLongitude(), new DateTime(personAddress.getStartDate()), new DateTime(personAddress.getEndDate()), new DateTime(person.getBirthdate()), person.getBirthdateEstimated(), person.getGender(), person.getDead(), ""); verify(personService).updatePerson(eq(null), personCaptor.capture()); assertEquals(person, personCaptor.getValue()); }

Target:
public void shouldUpdatePersonWithGivenParameters() { Person person = createTestPerson(); Concept causeOfDeath = createTestConcept("testCauseOfDeathConcept"); person.setDead(true); person.setCauseOfDeath(causeOfDeath); Person.Address personAddress = person.getPreferredAddress(); doReturn(causeOfDeath).when(conceptService).getConceptByUuid(eq(null), eq(causeOfDeath.getUuid())); openMRSActionProxyService.updatePerson(person.getUuid(), person.getPreferredName().getGivenName(), person.getPreferredName().getMiddleName(), person.getPreferredName().getFamilyName(), personAddress.getAddress1(), personAddress.getAddress2(), personAddress.getAddress3(), personAddress.getAddress4(), personAddress.getAddress5(), personAddress.getAddress6(), personAddress.getCityVillage(), personAddress.getStateProvince(), personAddress.getCountry(), personAddress.getPostalCode(), personAddress.getCountyDistrict(), personAddress.getLatitude(), personAddress.getLongitude(), new DateTime(personAddress.getStartDate()), new DateTime(personAddress.getEndDate()), new DateTime(person.getBirthdate()), person.getBirthdateEstimated(), person.getGender(), person.getDead(), causeOfDeath.getUuid()); verify(personService).updatePerson(eq(null), personCaptor.capture()); assertEquals(person, personCaptor.getValue()); }
Source:
public ParameterTypeRegistry createParameterTypeRegistry() { ParameterTypeRegistry parameterTypeRegistry = new ParameterTypeRegistry(ENGLISH); parameterTypeRegistry.defineParameterType(new ParameterType<Integer>( "digit", "([0-9])", Integer.class, new SingleTransformer<Integer>(new Function<String, Integer>() { @Override public Integer apply(String text) { return Integer.parseInt(text); } }) )); parameterTypeRegistry.defineParameterType(new ParameterType<Character>( "operator", "([+–x\\/=])", Character.class, new SingleTransformer<Character>(new Function<String, Character>() { @Override public Character apply(String text) { return text.charAt(0); } }) )); return parameterTypeRegistry; }

Target:
public ParameterTypeRegistry createParameterTypeRegistry() { ParameterTypeRegistry typeRegistry = new ParameterTypeRegistry(ENGLISH); typeRegistry.defineParameterType(new ParameterType<Integer>( "digit", "[0-9]", Integer.class, new SingleTransformer<Integer>(new Function<String, Integer>() { @Override public Integer apply(String text) { return Integer.parseInt(text); } }) )); typeRegistry.defineParameterType(new ParameterType<Character>( "operator", "[+–x\\/=]", Character.class, new SingleTransformer<Character>(new Function<String, Character>() { @Override public Character apply(String text) { return text.charAt(0); } }) )); return typeRegistry; }
Source:
public static StringLiteral extractDocstring(@Nullable StatementList statements) { if (statements != null) { Statement firstStatement = statements.statements().get(0); return firstStatement.is(Tree.Kind.EXPRESSION_STMT) && ((ExpressionStatement) firstStatement).expressions().size() == 1 && firstStatement.children().get(0).is(Tree.Kind.STRING_LITERAL) ? (StringLiteral) firstStatement.children().get(0) : null; } return null; }

Target:
public static StringLiteral extractDocstring(@Nullable StatementList statements) { if (statements != null) { Statement firstStatement = statements.statements().get(0); if (firstStatement.is(Tree.Kind.EXPRESSION_STMT) && ((ExpressionStatement) firstStatement).expressions().size() == 1 && firstStatement.children().get(0).is(Tree.Kind.STRING_LITERAL)) { return (StringLiteral) firstStatement.children().get(0); } } return null; }
Source:
private AxonServerEventScheduler(Builder builder) { this.axonServerConnectionManager = builder.axonServerConnectionManager; this.axonServerConfiguration = builder.axonServerConfiguration; this.serializer = builder.eventSerializer.get(); this.converter = new GrpcMetaDataConverter(serializer); }

Target:
protected AxonServerEventScheduler(Builder builder) { this.axonServerConnectionManager = builder.axonServerConnectionManager; this.axonServerConfiguration = builder.axonServerConfiguration; this.serializer = builder.eventSerializer.get(); this.converter = new GrpcMetaDataConverter(serializer); }
Source:
static boolean useKafkaTimestamp(SecorConfig config) { return config.getBoolean("kafka.useTimestamp", false); }

Target:
static boolean useKafkaTimestamp(SecorConfig config) { return config.useKafkaTimestamp(); }