auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void afterPropertiesSet() throws Exception { Map<String, StreamListenerParameterAdapter> parameterAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerParameterAdapter.class); for (StreamListenerParameterAdapter parameterAdapter : parameterAdapterMap.values()) { this.streamListenerParameterAdapters.add(parameterAdapter); } Map<String, StreamListenerResultAdapter> resultAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); for (StreamListenerResultAdapter resultAdapter : resultAdapterMap.values()) { this.streamListenerResultAdapters.add(resultAdapter); } }

Target:
public void afterPropertiesSet() throws Exception { Map<String, StreamListenerParameterAdapter> parameterAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerParameterAdapter.class); parameterAdapterMap.values().iterator().forEachRemaining(this.streamListenerParameterAdapters::add); Map<String, StreamListenerResultAdapter> resultAdapterMap = BeanFactoryUtils .beansOfTypeIncludingAncestors(this.applicationContext, StreamListenerResultAdapter.class); this.streamListenerResultAdapters.add(new MessageChannelStreamListenerResultAdapter()); resultAdapterMap.values().iterator().forEachRemaining(this.streamListenerResultAdapters::add); }
Source:
private static PerformanceReportParser getParserUsingAntPatternAbsolutePath(Run<?, ?> build, FilePath wsp, PrintStream logger, File path) throws InterruptedException { try { File parent = path.getParentFile(); FilePath workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); while (!workspace.exists()) { parent = parent.getParentFile(); if (parent != null) { workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); } else { return null; } } String glob = path.getAbsolutePath().substring(parent.getAbsolutePath().length() + 1); FilePath[] pathList = workspace.list(glob); for (FilePath src : pathList) { final File localReport = new File(build.getRootDir(), "/temp/" + src.getName()); if (src.isDirectory()) { logger.println("Performance: File '" + src.getName() + "' is a directory, not a Performance Report"); continue; } src.copyTo(new FilePath(localReport)); return getParser(ParserDetector.detect(localReport.getPath()), localReport.getPath()); } } catch (IOException ignored) { } return null; }

Target:
private static PerformanceReportParser getParserUsingAntPatternAbsolutePath(Run<?, ?> build, FilePath wsp, PrintStream logger, File path) throws InterruptedException { try { File parent = path.getParentFile(); FilePath workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); while (!workspace.exists()) { parent = parent.getParentFile(); if (parent != null) { workspace = new FilePath(wsp.getChannel(), parent.getAbsolutePath()); } else { return null; } } String glob = path.getAbsolutePath().substring(parent.getAbsolutePath().length() + 1); FilePath[] pathList = workspace.list(glob); for (FilePath src : pathList) { final File localReport = new File(build.getRootDir(), "/temp/" + src.getName()); if (src.isDirectory()) { logger.println("Performance: File '" + src.getName() + "' is a directory, not a Performance Report"); continue; } src.copyTo(new FilePath(localReport)); return getParser(ParserDetector.detect(localReport.getPath()), localReport.getPath()); } } catch (IOException ignored) { LOGGER.log(Level.FINE, "Cannot find report file using Ant pattern", ignored); } return null; }
Source:
public void showPermanently(String arrowCharacter) { super.setText(arrowCharacter); getHandler().removeCallbacks(clearTextRunnable); }

Target:
public void showPermanently(String arrowCharacter) { setText(arrowCharacter); getHandler().removeCallbacks(clearTextRunnable); }
Source:
private void doTaskEnd() { if(started) { this.taskExecution.setEndTime(new Date()); this.taskExecution.setExitCode(0); taskRepository.update(taskExecution); } else { logger.warn("An event to end a task has been received for a task that has " + "not yet started."); } }

Target:
private void doTaskEnd() { if(started) { this.taskExecution.setEndTime(new Date()); this.taskExecution.setExitCode(0); taskRepository.update(taskExecution); } else { logger.error("An event to end a task has been received for a task that has " + "not yet started."); } }
Source:
private Connection<ShuffleControlMessage> getConnection(final String endPointId) { if (connectionFactory == null) { connectionFactory = networkSetup.getControlConnectionFactory(); } synchronized (connectionMap) { if (!connectionMap.containsKey(endPointId)) { connectionMap.put(endPointId, connectionFactory.newConnection(idFactory.getNewInstance(endPointId))); } return connectionMap.get(endPointId); } }

Target:
private Connection<ShuffleControlMessage> getConnection(final String endPointId) { synchronized (connectionMap) { if (!connectionMap.containsKey(endPointId)) { connectionMap.put(endPointId, connectionFactory.newConnection(idFactory.getNewInstance(endPointId))); } return connectionMap.get(endPointId); } }
Source:
public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) { this.parameterDefinitions = parameterDefinitions != null ? parameterDefinitions : new ArrayList(); }

Target:
public ParametersDefinitionProperty(@Nonnull List<ParameterDefinition> parameterDefinitions) { this.parameterDefinitions = parameterDefinitions != null ? parameterDefinitions : new ArrayList<>(); }
Source:
@Override public void injectMembers(Set<T> t) { throw new UnsupportedOperationException(); }

Target:
@Override public void injectMembers(Set<T> t) { throw new UnsupportedOperationException("Cannot inject into a multi-binder Set"); }
Source:
public PhoneAccountHandle getSensibleAccountHandle(String dialNumber) { TelecomManager telecomManager = TelecomManager.from(mContext); List<PhoneAccountHandle> availablePhoneAccounts = telecomManager.getPhoneAccountsSupportingScheme(PhoneAccount.SCHEME_TEL); PhoneAccountHandle defaultPhoneAccount = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL); PhoneAccountHandle phoneAccountFromNumber = getAccountHandleFromNumber(dialNumber); if (phoneAccountFromNumber != null && availablePhoneAccounts.contains(phoneAccountFromNumber)) { return phoneAccountFromNumber; } else if (defaultPhoneAccount != null && availablePhoneAccounts.contains(defaultPhoneAccount)) { return defaultPhoneAccount; } else if (availablePhoneAccounts.size() >= 1) { return availablePhoneAccounts.get(0); } return null; }

Target:
public PhoneAccountHandle getSensibleAccountHandle(String dialNumber) { TelecomManager telecomManager = TelecomManager.from(mContext); List<PhoneAccountHandle> availablePhoneAccounts = telecomManager.getPhoneAccountsSupportingScheme(PhoneAccount.SCHEME_TEL); PhoneAccountHandle defaultPhoneAccount = telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL); PhoneAccountHandle phoneAccountFromNumber = getAccountHandleFromNumber(dialNumber); if (phoneAccountFromNumber != null && availablePhoneAccounts.contains(phoneAccountFromNumber)) { return phoneAccountFromNumber; } else if (defaultPhoneAccount != null && availablePhoneAccounts.contains(defaultPhoneAccount)) { return defaultPhoneAccount; } else if (!availablePhoneAccounts.isEmpty()) { return availablePhoneAccounts.get(0); } return null; }
Source:
public final void synch() { try { checkOpenness(); stateLock.acquireReadLock(); try { final long timer = Orient.instance().getProfiler().startChrono(); final long lockId = atomicOperationsManager.freezeAtomicOperations(null, null); try { checkOpenness(); if (jvmError.get() == null) { for (final OBaseIndexEngine indexEngine : indexEngines) { try { if (indexEngine != null) { indexEngine.flush(); } } catch (final Throwable t) { OLogManager.instance().error(this, "Error while flushing index via index emakeFullCheckpointngine of class %s.", t, indexEngine.getClass().getSimpleName()); } } makeFullCheckpoint(); } else { OLogManager.instance().errorNoDb(this, "Sync can not be performed because of JVM error on storage", null); } } finally { atomicOperationsManager.releaseAtomicOperations(lockId); Orient.instance().getProfiler().stopChrono("db." + name + ".synch", "Synch a database", timer, "db.*.synch"); } } finally { stateLock.releaseReadLock(); } } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); } }

Target:
public final void synch() { try { checkOpenness(); stateLock.acquireReadLock(); try { final long timer = Orient.instance().getProfiler().startChrono(); final long lockId = atomicOperationsManager.freezeAtomicOperations(null, null); try { checkOpenness(); if (jvmError.get() == null) { for (final OBaseIndexEngine indexEngine : indexEngines) { try { if (indexEngine != null) { indexEngine.flush(); } } catch (final Throwable t) { OLogManager.instance().error(this, "Error while flushing index via index engine of class %s.", t, indexEngine.getClass().getSimpleName()); } } makeFullCheckpoint(); } else { OLogManager.instance().errorNoDb(this, "Sync can not be performed because of JVM error on storage", null); } } finally { atomicOperationsManager.releaseAtomicOperations(lockId); Orient.instance().getProfiler().stopChrono("db." + name + ".synch", "Synch a database", timer, "db.*.synch"); } } finally { stateLock.releaseReadLock(); } } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); } }
Source:
protected boolean checkValidVersion(Set<SourceFile> sourceFiles, Tool entry) { boolean isValidCWL = false; String cwlPrimaryDescriptorPath = "/Dockstore.cwl"; Optional<SourceFile> cwlPrimaryDescriptor = sourceFiles.stream().filter(sf -> Objects.equals(sf.getPath(), cwlPrimaryDescriptorPath)).findFirst(); if (cwlPrimaryDescriptor.isPresent()) { isValidCWL = true; } boolean isValidWDL = false; String wdlPrimaryDescriptorPath = "/Dockstore.wdl"; Optional<SourceFile> wdlPrimaryDescriptor = sourceFiles.stream().filter(sf -> Objects.equals(sf.getPath(), wdlPrimaryDescriptorPath)).findFirst(); if (wdlPrimaryDescriptor.isPresent()) { isValidWDL = true; } boolean hasDockerfile = false; String dockerfilePath = "/Dockerfile"; Optional<SourceFile> dockerfile = sourceFiles.stream().filter(sf -> Objects.equals(sf.getPath(), dockerfilePath)).findFirst(); if (dockerfile.isPresent()) { hasDockerfile = true; } return (isValidCWL || isValidWDL) && hasDockerfile; }

Target:
protected boolean checkValidVersion(Set<SourceFile> sourceFiles, Tool entry) { boolean isValidCWL = sourceFiles.stream().anyMatch(sf -> Objects.equals(sf.getPath(), "/Dockstore.cwl")); boolean isValidWDL = sourceFiles.stream().anyMatch(sf -> Objects.equals(sf.getPath(), "/Dockstore.wdl")); boolean hasDockerfile = sourceFiles.stream().anyMatch(sf -> Objects.equals(sf.getPath(), "/Dockerfile")); return (isValidCWL || isValidWDL) && hasDockerfile; }
Source:
protected <T> HandlerHolder<T> addRegistration(String address, HandlerRegistration<T> registration, boolean replyHandler, boolean localOnly) { Objects.requireNonNull(registration.getHandler(), "handler"); LocalRegistrationResult result = addLocalRegistration(address, registration, replyHandler, localOnly); addRegistration(result.newAddress, address, replyHandler, localOnly, registration::setResult); return result.holder; }

Target:
protected <T> HandlerHolder<T> addRegistration(String address, HandlerRegistration<T> registration, boolean replyHandler, boolean localOnly) { Objects.requireNonNull(registration.getHandler(), "handler"); LocalRegistrationResult<T> result = addLocalRegistration(address, registration, replyHandler, localOnly); addRegistration(result.newAddress, address, replyHandler, localOnly, registration::setResult); return result.holder; }
Source:
protected Hardware findHardwareWithId(Set<? extends Hardware> hardwaresToSearch) { try { return super.findHardwareWithId(hardwaresToSearch); } catch (Exception NoSuchElementException) { if (isAutomaticId(hardwareId)) { AutomaticHardwareIdSpec spec = parseId(hardwareId); return automaticHardwareForCpuAndRam(spec.getCores(), spec.getRam()); } else{ throw throwNoSuchElementExceptionAfterLoggingHardwareIds("Invalid hardwareId", hardwaresToSearch); } } }

Target:
protected Hardware findHardwareWithId(Set<? extends Hardware> hardwaresToSearch) { try { return super.findHardwareWithId(hardwaresToSearch); } catch (NoSuchElementException ex) { if (isAutomaticId(hardwareId)) { AutomaticHardwareIdSpec spec = parseId(hardwareId); return automaticHardwareForCpuAndRam(spec.getCores(), spec.getRam()); } else { throw ex; } } }
Source:
protected void processCapabilityRequirement(OperationContext context, Resource resource, String attributeName, boolean remove, String... attributeValues) { RuntimeCapability cap = getDependentCapability(context); String dependentName = getDependentName(cap, context); for (String attributeValue : attributeValues) { if (attributeValue != null || !cap.getDynamicOptionalRequirements().contains(baseRequirementName)) { String requirementName = getRequirementName(context, resource, attributeValue); if (remove) { context.deregisterCapabilityRequirement(requirementName, dependentName); } else { context.registerAdditionalCapabilityRequirement(requirementName, dependentName, attributeName); } } } }

Target:
protected void processCapabilityRequirement(OperationContext context, Resource resource, String attributeName, boolean remove, String... attributeValues) { RuntimeCapability cap = getDependentCapability(context); String dependentName = getDependentName(cap, context); for (String attributeValue : attributeValues) { if (attributeValue != null) { String requirementName = getRequirementName(context, resource, attributeValue); if (remove) { context.deregisterCapabilityRequirement(requirementName, dependentName); } else { context.registerAdditionalCapabilityRequirement(requirementName, dependentName, attributeName); } } } }
Source:
private ChannelPipelineFactory initChannelPipelineFactory() { ChannelPipelineFactory pipelineFactory; boolean enableCompression = compressionType.equalsIgnoreCase("deflate"); if (enableCompression || enableSsl || enableIpFilter) { pipelineFactory = new AdvancedChannelPipelineFactory( enableCompression, enableSsl, keystore, keystorePassword, keystoreType, enableIpFilter, patternRuleConfigDefinition); } else { pipelineFactory = () -> Channels.pipeline(); } return pipelineFactory; }

Target:
private ChannelPipelineFactory initChannelPipelineFactory() { ChannelPipelineFactory pipelineFactory; boolean enableCompression = compressionType.equalsIgnoreCase("deflate"); if (enableCompression || enableSsl || enableIpFilter) { pipelineFactory = new AdvancedChannelPipelineFactory( enableCompression, enableSsl, keystore, keystorePassword, keystoreType, enableIpFilter, patternRuleConfigDefinition); } else { pipelineFactory = Channels::pipeline; } return pipelineFactory; }
Source:
public void connectionsToRemovedMember_shouldBeClosed() { Config config = new Config() .setProperty(GroupProperty.MAX_NO_HEARTBEAT_SECONDS.getName(), "20") .setProperty(GroupProperty.HEARTBEAT_INTERVAL_SECONDS.getName(), "1"); HazelcastInstance hz1 = factory.newHazelcastInstance(config); HazelcastInstance hz2 = factory.newHazelcastInstance(config); HazelcastInstance hz3 = factory.newHazelcastInstance(config); assertClusterSizeEventually(3, hz1, hz2, hz3); final Address target = getAddress(hz3); ConnectionRemovedListener connListener1 = new ConnectionRemovedListener(target); getEndpointManager(hz1).addConnectionListener(connListener1); ConnectionRemovedListener connListener2 = new ConnectionRemovedListener(target); getEndpointManager(hz2).addConnectionListener(connListener2); dropOperationsBetween(hz3, hz1, F_ID, singletonList(HEARTBEAT)); assertClusterSizeEventually(2, hz1, hz2); connListener1.assertConnectionRemoved(); connListener2.assertConnectionRemoved(); }

Target:
public void connectionsToRemovedMember_shouldBeClosed() { Config config = new Config(); HazelcastInstance hz1 = factory.newHazelcastInstance(config); HazelcastInstance hz2 = factory.newHazelcastInstance(config); HazelcastInstance hz3 = factory.newHazelcastInstance(config); assertClusterSizeEventually(3, hz1, hz2, hz3); final Address target = getAddress(hz3); ConnectionRemovedListener connListener1 = new ConnectionRemovedListener(target); getEndpointManager(hz1).addConnectionListener(connListener1); ConnectionRemovedListener connListener2 = new ConnectionRemovedListener(target); getEndpointManager(hz2).addConnectionListener(connListener2); dropOperationsBetween(hz3, hz1, F_ID, singletonList(HEARTBEAT)); suspectMember(hz1, hz3); assertClusterSizeEventually(2, hz1, hz2); connListener1.assertConnectionRemoved(); connListener2.assertConnectionRemoved(); }
Source:
private void sendOnOpenMessage(ChannelHandlerContext ctx, boolean isSecured, String uri) throws URISyntaxException { cMsg = new StatusCarbonMessage(org.wso2.carbon.messaging.Constants.STATUS_OPEN, 0, null); Session session = new WebSocketSessionImpl(ctx, isSecured, uri, channelId); setupCarbonMessage(ctx); cMsg.setProperty(Constants.CONNECTION, Constants.UPGRADE); cMsg.setProperty(Constants.UPGRADE, Constants.WEBSOCKET_UPGRADE); publishToMessageProcessor(cMsg); }

Target:
private void sendOnOpenMessage(ChannelHandlerContext ctx, boolean isSecured, String uri) throws URISyntaxException { cMsg = new StatusCarbonMessage(org.wso2.carbon.messaging.Constants.STATUS_OPEN, 0, null); setupCarbonMessage(ctx); cMsg.setProperty(Constants.CONNECTION, Constants.UPGRADE); cMsg.setProperty(Constants.UPGRADE, Constants.WEBSOCKET_UPGRADE); publishToMessageProcessor(cMsg); }
Source:
protected Operation prepareOperation() { MapEntries mapEntries = new MapEntries(parameters.entries); MapOperationProvider operationProvider = getMapOperationProvider(parameters.name); return operationProvider.createPutAllOperation(parameters.name, mapEntries, parameters.triggerMapLoader); }

Target:
protected Operation prepareOperation() { MapEntries mapEntries = new MapEntries(parameters.entries); MapOperationProvider operationProvider = getMapOperationProvider(parameters.name); return operationProvider.createPutAllOperation(parameters.name, mapEntries, !parameters.isTriggerMapLoaderExists || parameters.triggerMapLoader); }
Source:
protected Map<String, String> getExclusiveLocks() { if (getVdsGroup().supportsGlusterService() && !isInternalExecution()) { return Collections.singletonMap(getVdsGroupId().toString(), LockingGroup.GLUSTER.name()); } return super.getExclusiveLocks(); }

Target:
protected Map<String, String> getExclusiveLocks() { if (getVdsGroup().supportsGlusterService() && !isInternalExecution()) { return Collections.singletonMap(getVdsGroupId().toString(), LockingGroup.GLUSTER.name()); } return null; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (operatingSystemMXBean == null) chain.doFilter(request, response); assert HttpServletRequest.class.isAssignableFrom(request.getClass()); HttpServletRequest httpRequest = (HttpServletRequest) request; assert HttpServletResponse.class.isAssignableFrom(response.getClass()); HttpServletResponse httpResponse = (HttpServletResponse) response; if (shouldBypassThrottling(httpRequest)) chain.doFilter(request, response); double systemLoad = operatingSystemMXBean.getSystemLoadAverage(); if (systemLoad > systemLoadLimit) notifyOverloaded(httpResponse, systemLoad); else chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (operatingSystemMXBean == null) chain.doFilter(request, response); assert HttpServletRequest.class.isAssignableFrom(request.getClass()); HttpServletRequest httpRequest = (HttpServletRequest) request; assert HttpServletResponse.class.isAssignableFrom(response.getClass()); HttpServletResponse httpResponse = (HttpServletResponse) response; if (shouldBypassThrottling(httpRequest)) { chain.doFilter(request, response); return; } if (shouldDropRequest(ratioOfRequestsToDrop())) notifyOverloaded(httpResponse); else chain.doFilter(request, response); }
Source:
public void testGetVmBootActiveSharedDisk() { Disk bootDiskVm1 = dao.getVmBootActiveDisk(FixturesTool.VM_VM1_SHARED_BOOTABLE_DISK); Disk bootDiskVm2 = dao.getVmBootActiveDisk(FixturesTool.VM_VM2_SHARED_NONBOOTABLE_DISK); assertNull(bootDiskVm2, "VM2 should not have a boot disk attached"); assertNotNull(bootDiskVm1, "VM1 should have a boot disk attached"); assertEquals(FixturesTool.BOOTABLE_SHARED_DISK_ID, bootDiskVm1.getId(), "Wrong boot disk for VM"); }

Target:
public void testGetVmBootActiveSharedDisk() { Disk bootDiskVm1 = dao.getVmBootActiveDisk(FixturesTool.VM_VM1_SHARED_BOOTABLE_DISK); Disk bootDiskVm2 = dao.getVmBootActiveDisk(FixturesTool.VM_VM2_SHARED_NONBOOTABLE_DISK); assertNull(bootDiskVm2, "VM2 should not have a bootable disk attached"); assertNotNull(bootDiskVm1, "VM1 should have a bootable disk attached"); assertEquals(FixturesTool.BOOTABLE_SHARED_DISK_ID, bootDiskVm1.getId(), "Wrong boot disk for VM"); }
Source:
public void testTransformMetacard() throws CatalogTransformerException, IOException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); assertThat("Transformer cannot be null", transformer, notNullValue()); Metacard mockMetacard = createMockMetacard("Test Metacard Title"); BinaryContent content = transformer.transform(mockMetacard, new HashMap<>()); assertThat("Transformed content cannot be null", content, notNullValue()); assertThat( "Content mime type must be 'application/rtf'", content.getMimeType().toString(), equalTo("application/rtf")); assertThat("Content must not be empty", content.getByteArray().length, greaterThan(0)); }

Target:
public void testTransformMetacard() throws CatalogTransformerException, IOException, MimeTypeParseException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); Metacard mockMetacard = createMockMetacard("Test Metacard Title"); BinaryContent content = transformer.transform(mockMetacard, Collections.emptyMap()); assertThat("Transformed content cannot be null", content, notNullValue()); assertThat( "Content mime type must be 'application/rtf'", content.getMimeType().toString(), equalTo("application/rtf")); String rtfResult = inputStreamToString(content.getInputStream()); assertThat("Content must not be empty", rtfResult, is(not(isEmptyOrNullString()))); String referenceRtf = getReferenceMetacardRtfFile(); assertThat("Produced RTF document must match reference", rtfResult, equalTo(referenceRtf)); }
Source:
public List<RecordedEvent> deserializeRecordedEvents(String path) { List<RecordedEvent> events = new ArrayList<>(); JsonObject jsonObject; try { JsonParser parser = new JsonParser(); JsonElement jsonElement = parser.parse(new FileReader(path)); jsonObject = jsonElement.getAsJsonObject(); JsonArray jsonEvents = jsonObject.getAsJsonArray("events"); String clazz; long refId; long timestamp; long position; Event event; for (JsonElement element : jsonEvents) { jsonObject = element.getAsJsonObject(); clazz = jsonObject.get("event_class").getAsString(); refId = jsonObject.get("entityRef_ID").getAsLong(); position = jsonObject.get("position").getAsLong(); timestamp = jsonObject.get("timestamp").getAsLong(); event = deserializeSpecificEventData(jsonObject.get("event_data").getAsJsonObject(), clazz); RecordedEvent re = new RecordedEvent(refId, event, timestamp, position); events.add(re); } } catch (Exception e) { logger.error(e.getMessage()); } return events; }

Target:
List<RecordedEvent> deserializeRecordedEvents(String path) { List<RecordedEvent> events = new ArrayList<>(); JsonObject jsonObject; try { JsonParser parser = new JsonParser(); JsonElement jsonElement = parser.parse(new FileReader(path)); jsonObject = jsonElement.getAsJsonObject(); JsonArray jsonEvents = jsonObject.getAsJsonArray("events"); for (JsonElement element : jsonEvents) { jsonObject = element.getAsJsonObject(); String clazz = jsonObject.get("event_class").getAsString(); long refId = jsonObject.get("entityRef_ID").getAsLong(); long position = jsonObject.get("position").getAsLong(); long timestamp = jsonObject.get("timestamp").getAsLong(); Event event = deserializeSpecificEventData(jsonObject.get("event_data").getAsJsonObject(), clazz); RecordedEvent re = new RecordedEvent(refId, event, timestamp, position); events.add(re); } } catch (Exception e) { logger.error("Error while deserializing event:", e); } return events; }
Source:
public static WSResponse startJob(String conf_id, String url, String record_id) { Configuration runConfig = getConfigurationFromDb(conf_id); List<TextAnnotation> correctInstances = getInstancesFromDb(runConfig); List<TextAnnotation> cleanseInstances = getInstancesFromDb(runConfig); System.out.println(url); LearnerInterface learner = new LearnerInterface(url); String jsonInfo = learner.getInfo(); if (jsonInfo.equals("err")) { System.out.println("Could not connect to server"); return null; } cleanseInstances(cleanseInstances, jsonInfo); if (cleanseInstances == null) { System.out.println("Error in cleanser"); return null; } Job newJob = new Job(learner, cleanseInstances); WSResponse solverResponse = newJob.sendAndReceiveRequestsFromSolver(); List<TextAnnotation> solvedInstances = newJob.getSolverInstances(); List<Boolean> skip = newJob.getSkip(); EvaluationRecord eval = evaluate(runConfig, correctInstances, solvedInstances, skip); storeEvaluationIntoDb(eval, record_id); System.out.println(solverResponse); return solverResponse; }

Target:
public static WSResponse startJob(String conf_id, String url, String record_id) { Configuration runConfig = getConfigurationFromDb(conf_id); List<TextAnnotation> correctInstances = getInstancesFromDb(runConfig); List<TextAnnotation> cleansedInstances = getInstancesFromDb(runConfig); System.out.println(url); LearnerInterface learner = new LearnerInterface(url); String jsonInfo = learner.getInfo(); if (jsonInfo.equals("err")) { System.out.println("Could not connect to server"); return null; } cleanseInstances(cleansedInstances, jsonInfo); if (cleansedInstances == null) { System.out.println("Error in cleanser"); return null; } Job newJob = new Job(learner, cleansedInstances); WSResponse solverResponse = newJob.sendAndReceiveRequestsFromSolver(); List<TextAnnotation> solvedInstances = newJob.getSolverInstances(); List<Boolean> skip = newJob.getSkip(); EvaluationRecord eval = evaluate(runConfig, correctInstances, solvedInstances, skip); storeEvaluationIntoDb(eval, record_id); System.out.println(solverResponse); return solverResponse; }
Source:
protected void executeVmCommand() { boolean isPlugged = getParameters().getAction() == PlugAction.PLUG; if (isPlugged){ clearAddressIfPciSlotIsDuplicated(vmDevice); } if (hotPlugVmNicRequired(getVm().getStatus())) { boolean externalNetworkIsPlugged = isPlugged && getNetwork() != null && getNetwork().isExternal(); if (externalNetworkIsPlugged) { plugToExternalNetwork(); } try { runVdsCommand(getParameters().getAction().getCommandType(), new VmNicDeviceVDSParameters(getVdsId(), getVm(), getParameters().getNic(), vmDevice)); } catch (EngineException e) { if (externalNetworkIsPlugged && getParameters().isNewNic()) { unplugFromExternalNetwork(); } throw e; } } TransactionSupport.executeInNewTransaction(updateDevice()); setSucceeded(true); }

Target:
protected void executeVmCommand() { boolean isNicToBePlugged = getParameters().getAction() == PlugAction.PLUG; if (isNicToBePlugged){ clearAddressIfPciSlotIsDuplicated(vmDevice); } if (hotPlugVmNicRequired(getVm().getStatus())) { boolean externalNetworkIsPlugged = isNicToBePlugged && getNetwork() != null && getNetwork().isExternal(); if (externalNetworkIsPlugged) { plugToExternalNetwork(); } try { runVdsCommand(getParameters().getAction().getCommandType(), new VmNicDeviceVDSParameters(getVdsId(), getVm(), getParameters().getNic(), vmDevice)); } catch (EngineException e) { if (externalNetworkIsPlugged && getParameters().isNewNic()) { unplugFromExternalNetwork(); } throw e; } } TransactionSupport.executeInNewTransaction(updateDevice()); setSucceeded(true); }
Source:
public static <T> FactorComparator<T> create(String factorName, int weight, Comparator<T> comparator){ if (null == factorName || factorName == "" || weight < 0 || null == comparator){ logger.error("failed to create instance of FactorComparator, at least one of the input paramters are invalid"); return null; } return new FactorComparator<T>(factorName,weight,comparator); }

Target:
public static <T> FactorComparator<T> create(String factorName, int weight, Comparator<T> comparator){ if (null == factorName || factorName.length() == 0 || weight < 0 || null == comparator){ logger.error("failed to create instance of FactorComparator, at least one of the input paramters are invalid"); return null; } return new FactorComparator<T>(factorName,weight,comparator); }
Source:
public SpongeBreakableData(Set<BlockType> breakable) { super(BreakableData.class, breakable, Keys.BREAKABLE_BLOCK_TYPES); }

Target:
public SpongeBreakableData(Set<BlockType> breakable) { super(BreakableData.class, Sets.newHashSet(breakable), Keys.BREAKABLE_BLOCK_TYPES, ImmutableSpongeBreakableData.class); }
Source:
public Block getPositions(int[] positions, int offset, int length) { checkValidPositions(positions, offset, length, positionCount); int[] newIds = new int[length]; boolean isCompact = isCompact() && length >= dictionary.getPositionCount(); boolean[] seen = null; if (isCompact) { seen = new boolean[dictionary.getPositionCount()]; } for (int i = 0; i < length; i++) { newIds[i] = getId(positions[offset + i]); if (isCompact) { seen[newIds[i]] = true; } } for (int i = 0; i < dictionary.getPositionCount() && isCompact; i++) { isCompact &= seen[i]; } return new DictionaryBlock(newIds.length, getDictionary(), newIds, isCompact, getDictionarySourceId()); }

Target:
public Block getPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); int[] newIds = new int[length]; boolean isCompact = isCompact() && length >= dictionary.getPositionCount(); boolean[] seen = null; if (isCompact) { seen = new boolean[dictionary.getPositionCount()]; } for (int i = 0; i < length; i++) { newIds[i] = getId(positions[offset + i]); if (isCompact) { seen[newIds[i]] = true; } } for (int i = 0; i < dictionary.getPositionCount() && isCompact; i++) { isCompact &= seen[i]; } return new DictionaryBlock(newIds.length, getDictionary(), newIds, isCompact, getDictionarySourceId()); }
Source:
private static void testLinkStatus(SWTBotTreeItem traceItem, boolean isLinked) { SWTBotView viewBot = fBot.viewByTitle("Properties"); viewBot.setFocus(); fBot.waitUntil(ConditionHelpers.viewIsOpened(viewBot)); traceItem.select(); SWTBotTree tree = viewBot.bot().tree(); fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(RESOURCE_PROPERTIES_ITEM_NAME, tree)); SWTBotTreeItem resourcePropertiesItem = tree.getTreeItem(RESOURCE_PROPERTIES_ITEM_NAME); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(LINKED_ITEM_NAME, resourcePropertiesItem)); SWTBotTreeItem linkedNode = resourcePropertiesItem.getNode(LINKED_ITEM_NAME); String linkedValue = linkedNode.cell(1); assertEquals(Boolean.toString(isLinked), linkedValue); }

Target:
private static void testLinkStatus(SWTBotTreeItem traceItem, boolean isLinked) { SWTBotView viewBot = fBot.viewByTitle("Properties"); viewBot.show(); fBot.waitUntil(ConditionHelpers.viewIsOpened(viewBot)); traceItem.select(); SWTBotTree tree = viewBot.bot().tree(); SWTBotTreeItem resourcePropertiesItem = tree.getTreeItem(RESOURCE_PROPERTIES_ITEM_NAME); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(LINKED_ITEM_NAME, resourcePropertiesItem)); SWTBotTreeItem linkedNode = resourcePropertiesItem.getNode(LINKED_ITEM_NAME); String linkedValue = linkedNode.cell(1); assertEquals(Boolean.toString(isLinked), linkedValue); }
Source:
private String generateDisplayName(Map<String, String> surveyInstanceResponses) { StringBuilder displayName = new StringBuilder(); for (int i = 0; i < displayNameQuestionIds.size(); i++) { Long questionId = displayNameQuestionIds.get(i); displayName.append(surveyInstanceResponses.get(questionId.toString())); if (i < displayNameQuestionIds.size() - 1) { displayName.append(" - "); } } return displayName.toString(); }

Target:
private String generateDisplayName(Map<String, String> surveyInstanceResponses) { StringBuilder displayName = new StringBuilder(); for (Long questionId : displayNameQuestionIds) { displayName.append(surveyInstanceResponses.get(questionId.toString())).append(" - "); } int length = displayName.length(); displayName.delete(length - 3, length); return displayName.toString(); }
Source:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Optional<User> user = userFetcher.userFor(request); if (authenticationIsRequired(request) && !user.isPresent()) { ResponseWriter writer = writerResolver.writerFor(request, response); ErrorSummary summary = ErrorSummary.forException(new NotAuthorizedException()); new ErrorResultWriter().write(summary, writer, request, response); return false; } if (user.isPresent() && !user.get().isProfileComplete() && requiresCompleteProfile(request, user.get())) { ResponseWriter writer = writerResolver.writerFor(request, response); ErrorSummary summary = ErrorSummary.forException(new UserProfileIncompleteException()); new ErrorResultWriter().write(summary, writer, request, response); return false; } return true; }

Target:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Optional<User> user = userFetcher.userFor(request); String uri = request.getRequestURI(); if (!authorized(user, uri)) { writeError(request, response, new NotAuthorizedException()); return false; } else if (user.isPresent() && !hasProfile(user.get()) && needsProfile(uri, user.get())) { writeError(request, response, new UserProfileIncompleteException()); return false; } return true; }
Source:
protected String getPrimaryKeySelection() { return COL_LAST_USED + " = ?"; }

Target:
protected String getPrimaryKeySelection() { return COL_SUMMARY + " = ?"; }
Source:
private void handleResponse(MessageContext msgContext, HttpMethodBase method) throws IOException { int statusCode = method.getStatusCode(); HTTPStatusCodeFamily family = getHTTPStatusCodeFamily(statusCode); log.trace("Handling response - " + statusCode); Set<Integer> errorCodes = new HashSet<Integer>(); String strRetryErrorCodes = (String) msgContext.getProperty(HTTPConstants.ERROR_HTTP_STATUS_CODES); if (strRetryErrorCodes != null && !strRetryErrorCodes.trim().equals("")) { for (String strRetryErrorCode : strRetryErrorCodes.split(",")) { try { errorCodes.add(Integer.valueOf(strRetryErrorCode)); } catch (NumberFormatException e) { log.warn(strRetryErrorCode + " is not a valid status code"); } } } if (!errorCodes.contains(statusCode)) { msgContext.setProperty(HTTPConstants.HTTP_METHOD, method); processResponse(method, msgContext); } else { method.releaseConnection(); msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, method.getStatusCode()); AxisFault axisFault = new AxisFault( Messages.getMessage("transportError", String.valueOf(statusCode), method.getStatusText()), msgContext); axisFault.setFaultCode(String.valueOf(method.getStatusCode())); throw axisFault; } }

Target:
private void handleResponse(MessageContext msgContext, HttpMethodBase method) throws IOException { int statusCode = method.getStatusCode(); log.trace("Handling response - " + statusCode); Set<Integer> errorCodes = new HashSet<Integer>(); String strRetryErrorCodes = (String) msgContext.getProperty(HTTPConstants.ERROR_HTTP_STATUS_CODES); if (strRetryErrorCodes != null && !strRetryErrorCodes.trim().equals("")) { for (String strRetryErrorCode : strRetryErrorCodes.split(",")) { try { errorCodes.add(Integer.valueOf(strRetryErrorCode)); } catch (NumberFormatException e) { log.warn(strRetryErrorCode + " is not a valid status code"); } } } if (!errorCodes.contains(statusCode)) { msgContext.setProperty(HTTPConstants.HTTP_METHOD, method); processResponse(method, msgContext); } else { method.releaseConnection(); msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, method.getStatusCode()); AxisFault axisFault = new AxisFault( Messages.getMessage("transportError", String.valueOf(statusCode), method.getStatusText()), msgContext); axisFault.setFaultCode(String.valueOf(method.getStatusCode())); throw axisFault; } }
Source:
public void testNonExistingHomeFolder() throws Exception { System.setProperty("user.home", "/?"); final Object result = invokeGetHistory(); assertNotNull(result, "result is null"); final MemoryHistory history = (MemoryHistory) result; history.add("foo foo"); assertFalse(history instanceof PersistentHistory, "must not be PersistentHistory"); }

Target:
public void testNonExistingHomeFolder() throws Exception { final File historyFile = new File("/?", ".history"); assertFalse(historyFile.canRead(), "shouldn't read invalid location"); assertFalse(historyFile.canWrite(), "shouldn't write invalid location"); MemoryHistory result = Console.getHistory(historyFile); assertNotNull(result, "result is null"); result.add("foo foo"); assertFalse(result instanceof PersistentHistory, "must not be PersistentHistory"); }
Source:
private ResultSet getNextResultSet() { closeCurrentResultSet(); if (!tableIds.hasNext()) { return null; } Long tableId = tableIds.next(); Long columnId = metadataDao.getTemporalColumnId(tableId); String minColumn = "null"; String maxColumn = "null"; if (columnId != null) { Type columnType = metadataDao.getTableColumn(tableId, columnId).getDataType(); checkState(columnType.equals(DATE) || columnType.equals(TIMESTAMP), "Temporal column must be of type timestamp or date: " + columnType); if (columnType.equals(DATE)) { minColumn = convertDaysToMidnightTimestamp(minColumn(columnId)); maxColumn = convertDaysToMidnightTimestamp(maxColumn(columnId)); } else { minColumn = minColumn(columnId); maxColumn = maxColumn(columnId); } } List<String> columnNames = getMappedColumnNames(minColumn, maxColumn); try { connection = dbi.open().getConnection(); statement = PreparedStatementBuilder.create( connection, constructSqlTemplate(columnNames, tableId), columnNames, TYPES, ImmutableSet.of(getColumnIndex(SHARD_METADATA, SHARD_UUID)), tupleDomain); return statement.executeQuery(); } catch (SQLException | DBIException e) { close(); throw metadataError(e); } }

Target:
private ResultSet getNextResultSet() { closeCurrentResultSet(); if (!tableIds.hasNext()) { return null; } Long tableId = tableIds.next(); Long columnId = metadataDao.getTemporalColumnId(tableId); String minColumn = "null"; String maxColumn = "null"; if (columnId != null) { Type columnType = metadataDao.getTableColumn(tableId, columnId).getDataType(); checkState(columnType.equals(DATE) || columnType.equals(TIMESTAMP), "Temporal column must be of type timestamp or date: %s", columnType); if (columnType.equals(DATE)) { minColumn = convertDaysToMidnightTimestamp(minColumn(columnId)); maxColumn = convertDaysToMidnightTimestamp(maxColumn(columnId)); } else { minColumn = minColumn(columnId); maxColumn = maxColumn(columnId); } } List<String> columnNames = getMappedColumnNames(minColumn, maxColumn); try { connection = dbi.open().getConnection(); statement = PreparedStatementBuilder.create( connection, constructSqlTemplate(columnNames, tableId), columnNames, TYPES, ImmutableSet.of(getColumnIndex(SHARD_METADATA, SHARD_UUID)), tupleDomain); return statement.executeQuery(); } catch (SQLException | DBIException e) { close(); throw metadataError(e); } }
Source:
public void testCorruptedFrameExceptionInFinish() { EmbeddedChannel channel = new EmbeddedChannel(new Utf8FrameValidator()); try { channel.writeInbound(new TextWebSocketFrame(Unpooled.copiedBuffer(new byte[]{-50}))); Assert.fail(); } catch (CorruptedFrameException e) { } }

Target:
public void testCorruptedFrameExceptionInFinish() { assertCorruptedFrameExceptionHandling(new byte[]{-50}); }
Source:
public void testStateChangeWithTransitiveState() throws InterruptedException { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getMySqlVm(); for( InstanceStatus status : InstanceStatus.values()) { if( status.isStable()) continue; app.getMySql().setStatus( status ); processor.processMessage( new MsgCmdChangeInstanceState( app.getMySql(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( status, app.getMySql().getStatus()); } }

Target:
public void testStateChangeWithTransitiveState() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getMySqlVm(); for( InstanceStatus status : InstanceStatus.values()) { if( status.isStable()) continue; app.getMySql().setStatus( status ); processor.processMessage( new MsgCmdChangeInstanceState( app.getMySql(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( status, app.getMySql().getStatus()); } }
Source:
private static String requestPath(final Ds3Request ds3Request) { final StringBuilder builder = new StringBuilder(); if (ds3Request.getClassification() == Classification.amazons3) { builder.append("\"/\""); if (ds3Request.getBucketRequirement() == Requirement.REQUIRED) { builder.append(" + this.bucketName"); if (ds3Request.getObjectRequirement() == Requirement.REQUIRED) { builder.append(" + \"/\" + this.objectName"); } } } else { if (ds3Request.getResource() == Resource.BUCKET) { builder.append("\"/_rest_/bucket/\""); if (!queryParamsContain(ds3Request.getRequiredQueryParams(), "Name")) { builder.append(" + this.bucketName"); } } else { builder.append("\"/_rest_/\""); } } return builder.toString(); }

Target:
private static String requestPath(final Ds3Request ds3Request) { final StringBuilder builder = new StringBuilder(); if (ds3Request.getClassification() == Classification.amazons3) { builder.append("\"/\""); if (ds3Request.getBucketRequirement() == Requirement.REQUIRED) { builder.append(" + this.bucketName"); if (ds3Request.getObjectRequirement() == Requirement.REQUIRED) { builder.append(" + \"/\" + this.objectName"); } } } else { if (ds3Request.getResource() != null) { builder.append("\"/_rest_/" + ds3Request.getResource().toString().toLowerCase() + "/\""); if (!queryParamsContain(ds3Request.getRequiredQueryParams(), "Name")) { builder.append(" + this.bucketName"); } } else { builder.append("\"/_rest_/\""); } } return builder.toString(); }
Source:
public void takeThreadDump() throws FileNotFoundException, UnsupportedEncodingException { long iota = System.currentTimeMillis(); final SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd-HHmmss.SSS"); File file = threadDumps.file(format.format("threadDump-" + new Date(iota)) + ".txt"); threadDumps.add(file); PrintWriter writer; try { writer = new PrintWriter(file, "UTF-8"); } catch (FileNotFoundException e) { throw e; } catch (UnsupportedEncodingException e) { throw e; } ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threads; try { threads = mbean.dumpAllThreads(mbean.isObjectMonitorUsageSupported(), mbean.isSynchronizerUsageSupported()); } catch (UnsupportedOperationException x) { x.printStackTrace(writer); threads = new ThreadInfo[0]; } for (int ti = threads.length - 1; ti >= 0; ti--) { printThreadInfo(writer, threads[ti], mbean); } long[] deadLocks; try { deadLocks = mbean.findDeadlockedThreads(); } catch (UnsupportedOperationException x) { x.printStackTrace(writer); deadLocks = null; } if (deadLocks != null && deadLocks.length != 0) { writer.println(" Deadlock Found "); ThreadInfo[] deadLockThreads = mbean.getThreadInfo(deadLocks); for (ThreadInfo threadInfo : deadLockThreads) { StackTraceElement[] elements = threadInfo.getStackTrace(); for (StackTraceElement element : elements) { writer.println(element.toString()); } } } writer.println(); writer.flush(); writer.close(); }

Target:
public void takeThreadDump() throws FileNotFoundException, UnsupportedEncodingException { long iota = System.currentTimeMillis(); final SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd-HHmmss.SSS"); File file = threadDumps.file(format.format("threadDump-" + new Date(iota)) + ".txt"); threadDumps.add(file); PrintWriter writer; writer = new PrintWriter(file, "UTF-8"); ThreadMXBean mbean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threads; try { threads = mbean.dumpAllThreads(mbean.isObjectMonitorUsageSupported(), mbean.isSynchronizerUsageSupported()); } catch (UnsupportedOperationException x) { x.printStackTrace(writer); threads = new ThreadInfo[0]; } for (int ti = threads.length - 1; ti >= 0; ti--) { printThreadInfo(writer, threads[ti], mbean); } long[] deadLocks; try { deadLocks = mbean.findDeadlockedThreads(); if (deadLocks != null && deadLocks.length != 0) { writer.println(" Deadlock Found "); ThreadInfo[] deadLockThreads = mbean.getThreadInfo(deadLocks); for (ThreadInfo threadInfo : deadLockThreads) { StackTraceElement[] elements = threadInfo.getStackTrace(); for (StackTraceElement element : elements) { writer.println(element.toString()); } } } } catch (UnsupportedOperationException e) { e.printStackTrace(writer); } finally { writer.println(); writer.flush(); writer.close(); } }
Source:
private void addDescriptorToLookups( SchemaDescriptor schema ) { if ( schema.entityType() == EntityType.NODE ) { if ( schema.getEntityTokenIds().length == 0 ) { descriptorsForAllLabels.add( schema ); } for ( int entityTokenId : schema.getEntityTokenIds() ) { addToLookup( entityTokenId, schema, descriptorsByLabel ); } for ( int propertyId : schema.getPropertyIds() ) { addToLookup( propertyId, schema, descriptorsByProperty ); } } else if ( schema.entityType() == EntityType.RELATIONSHIP ) { if ( schema.getEntityTokenIds().length == 0 ) { descriptorsForAllReltypes.add( schema ); } for ( int entityTokenId : schema.getEntityTokenIds() ) { addToLookup( entityTokenId, schema, descriptorsByReltype ); } for ( int propertyId : schema.getPropertyIds() ) { addToLookup( propertyId, schema, relationshipDescriptorsByProperty ); } } }

Target:
private void addDescriptorToLookups( SchemaDescriptor schema ) { if ( schema.entityType() == EntityType.NODE ) { if ( SchemaDescriptor.isAnyEntityTokenSchema( schema ) ) { descriptorsForAllLabels.add( schema ); } for ( int entityTokenId : schema.getEntityTokenIds() ) { addToLookup( entityTokenId, schema, descriptorsByLabel ); } for ( int propertyId : schema.getPropertyIds() ) { addToLookup( propertyId, schema, nodeDescriptorsByProperty ); } } else if ( schema.entityType() == EntityType.RELATIONSHIP ) { if ( SchemaDescriptor.isAnyEntityTokenSchema( schema ) ) { descriptorsForAllReltypes.add( schema ); } for ( int entityTokenId : schema.getEntityTokenIds() ) { addToLookup( entityTokenId, schema, descriptorsByReltype ); } for ( int propertyId : schema.getPropertyIds() ) { addToLookup( propertyId, schema, relationshipDescriptorsByProperty ); } } }
Source:
public String apply(String text, String format) { final byte[] value; switch (Format.valueOf(format.toUpperCase(Locale.ROOT))) { case BASE64: value = Base64.getDecoder().decode(text.getBytes(StandardCharsets.UTF_8)); break; case HEX: return String.format(Locale.ROOT, "%s%s", Hex.HEX_FLAG, Hex.validateHex(text)); case ESCAPE: value = Octal.decode(text); break; default: throw new RuntimeException(); } assert value != null; return String.format(Locale.ROOT, "%s%s", Hex.HEX_FLAG, Hex.encodeHexString(value)); }

Target:
public String apply(String text, String format) { final Format fmt; try { fmt = Format.valueOf(format.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( String.format(Locale.ENGLISH, "Encoding format '%s' is not supported", format) ); } return fmt.decode(text); }
Source:
public static <T> DataType<T> dataType(String insertType, Type prestoResultType) { return new DataType<>(insertType, prestoResultType, Object::toString, Function.identity()); }

Target:
private static <T> DataType<T> dataType(String insertType, Type prestoResultType) { return new DataType<>(insertType, prestoResultType, Object::toString, Function.identity()); }