auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Constraint constraint(ProgramState state) { Set<Type> numberTypes = EnumSet.of(Type.NUMBER, Type.BOOLEAN); Type firstType = firstOperandValue.constraint(state).type(); Type secondType = secondOperandValue.constraint(state).type(); if (firstType != null || secondType != null) { if (firstType == Type.STRING || secondType == Type.STRING) { return Constraint.STRING; } else if (numberTypes.contains(firstType) || numberTypes.contains(secondType)) { return Constraint.NUMBER; } } return Constraint.NUMBER.or(Constraint.STRING); }

Target:
public Constraint constraint(ProgramState state) { Set<Type> numberTypes = EnumSet.of(Type.NUMBER, Type.BOOLEAN); Type firstType = firstOperandValue.constraint(state).type(); Type secondType = secondOperandValue.constraint(state).type(); if (firstType != null || secondType != null) { if (firstType == Type.STRING || secondType == Type.STRING) { return Constraint.STRING; } else if (numberTypes.contains(firstType) && numberTypes.contains(secondType)) { return Constraint.NUMBER; } } return Constraint.NUMBER.or(Constraint.STRING); }
Source:
public static void updateServerBinding(SonarQubeServer server, ConnectedSonarLintEngine engine, boolean background, boolean onlyProjects) { Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); List<Project> projects = new ArrayList<>(openProjects.length); List<String> moduleKeys = new ArrayList<>(openProjects.length); Set<String> unique = new HashSet<>(); for (Project p : openProjects) { SonarLintProjectSettings projectSettings = SonarLintUtils.get(p, SonarLintProjectSettings.class); String moduleKey = projectSettings.getProjectKey(); if (projectSettings.isBindingEnabled() && server.getName().equals(projectSettings.getServerId()) && moduleKey != null && unique.add(moduleKey)) { projects.add(p); moduleKeys.add(moduleKey); } } ServerUpdateTask task = new ServerUpdateTask(engine, server, projects, moduleKeys, onlyProjects); if (background) { ProgressManager.getInstance().run(task.asBackground()); } else { ProgressManager.getInstance().run(task.asModal()); } }

Target:
public static void updateServerBinding(SonarQubeServer server, ConnectedSonarLintEngine engine, boolean background, boolean onlyProjects) { Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); Map<String, List<Project>> projectsPerModule = new HashMap<>(); for (Project p : openProjects) { SonarLintProjectSettings projectSettings = SonarLintUtils.get(p, SonarLintProjectSettings.class); String moduleKey = projectSettings.getProjectKey(); if (projectSettings.isBindingEnabled() && server.getName().equals(projectSettings.getServerId()) && moduleKey != null) { List<Project> projects = projectsPerModule.computeIfAbsent(moduleKey, k -> new ArrayList<>()); projects.add(p); } } ServerUpdateTask task = new ServerUpdateTask(engine, server, projectsPerModule, onlyProjects); if (background) { ProgressManager.getInstance().run(task.asBackground()); } else { ProgressManager.getInstance().run(task.asModal()); } }
Source:
public static synchronized SparkSession getSession() { String threadName = Thread.currentThread().getName(); if (!SpliceClient.isClient() && !threadName.startsWith("olap-worker-")) { throw new RuntimeException("Trying to get a SparkSession from outside the OlapServer"); } SparkSession result = sessions.get(); if (result == null) { result = session.newSession(); sessions.set(result); } return result; }

Target:
public static synchronized SparkSession getSession() { String threadName = Thread.currentThread().getName(); if (!SpliceClient.isClient() && !threadName.startsWith("olap-worker-")) { throw new RuntimeException("Trying to get a SparkSession from outside the OlapServer"); } SparkSession result = sessions.get(); if (result == null) { result = getSessionUnsafe().newSession(); sessions.set(result); } return result; }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); config.validate(); if (!config.containsMacro("timeTable") && config.timeTable != null) { pipelineConfigurer.createDataset(config.timeTable, KeyValueTable.class, DatasetProperties.EMPTY); } if (config.getSchema() != null) { pipelineConfigurer.getStageConfigurer().setOutputSchema(config.getSchema()); } else { pipelineConfigurer.getStageConfigurer().setOutputSchema(DEFAULT_SCHEMA); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); config.validate(); if (!config.containsMacro("timeTable") && config.timeTable != null) { pipelineConfigurer.createDataset(config.timeTable, KeyValueTable.class, DatasetProperties.EMPTY); } if (config.getSchema() != null) { pipelineConfigurer.getStageConfigurer().setOutputSchema(config.getSchema()); } else if ("text".equalsIgnoreCase(config.format)) { pipelineConfigurer.getStageConfigurer().setOutputSchema(PathTrackingInputFormat.getTextOutputSchema (config.pathField)); } else { pipelineConfigurer.getStageConfigurer().setOutputSchema(null); } }
Source:
public void add(int index, E element) { throw new UnsupportedOperationException("No add(index) in " + this.getClass().getName()); }

Target:
public void add(int index, E element) { throw new UnsupportedOperationException("No add(int, E) in " + this.getClass().getName()); }
Source:
public void newServerDetailsChanged(IProgressMonitor monitor) { try { getWorkingCopyDelegate(monitor).newServerDetailsChanged(monitor); } catch (Exception e) { if (Trace.SEVERE) { Trace.trace(Trace.STRING_SEVERE, "Error calling delegate setDefaultServerName() " + toString(), e); } ServerUtil.setServerDefaultName(this); } }

Target:
public void newServerDetailsChanged(IProgressMonitor monitor) { try { getWorkingCopyDelegate(monitor).newServerDetailsChanged(monitor); } catch (Exception e) { if (Trace.SEVERE) { Trace.trace(Trace.STRING_SEVERE, "Error calling delegate newServerDetailsChanged() " + toString(), e); } } }
Source:
public Void call() throws Exception { mavenArtifactManagementService.store(repositoryPath, is); return null; }

Target:
public Exception call() throws Exception { try { mavenArtifactManagementService.store(repositoryPath, is); } catch (Exception ex) { return ex; } return null; }
Source:
public void testServerSpanNoURLClientSpanUnavailable() throws RetryAttemptException { SpanCache spanCacheMock = Mockito.mock(SpanCache.class); NodeDetailsDeriver nodeDetailsDeriver = new NodeDetailsDeriver(spanCacheMock); Annotation sr = new Annotation(); sr.setValue("sr"); sr.setTimestamp(0); Annotation ss = new Annotation(); ss.setTimestamp(1000); ss.setValue("ss"); Span serverSpan = new Span(Collections.emptyList(), Arrays.asList(sr, ss)); serverSpan.setId("2"); serverSpan.setTraceId("1"); serverSpan.setTimestamp(0L); serverSpan.setDuration(ss.getTimestamp() - sr.getTimestamp()); Mockito.when(spanCacheMock.get(null, SpanUniqueIdGenerator.getClientId(serverSpan.getId()))) .thenReturn(null); nodeDetailsDeriver.processOneToOne(null, serverSpan); }

Target:
public void testServerSpanNoURLClientSpanUnavailable() throws RetryAttemptException { SpanCache spanCacheMock = Mockito.mock(SpanCache.class); NodeDetailsDeriver nodeDetailsDeriver = new NodeDetailsDeriver(spanCacheMock); Annotation sr = new Annotation(); sr.setValue("sr"); Annotation ss = new Annotation(); ss.setValue("ss"); Span serverSpan = new Span(Collections.emptyList(), Arrays.asList(sr, ss)); serverSpan.setId("2"); serverSpan.setTraceId("1"); Mockito.when(spanCacheMock.get(null, SpanUniqueIdGenerator.getClientId(serverSpan.getId()))) .thenReturn(null); nodeDetailsDeriver.processOneToOne(null, serverSpan); }
Source:
public void testCheckThreadLocalLeaks() throws Exception { final ConfigurationBuilder builder = new ConfigurationBuilder(); builder .eviction().strategy(EvictionStrategy.LRU).maxEntries(4096) .locking().concurrencyLevel(2048) .loaders().passivation(false).shared(false).preload(true) .addFileCacheStore().location(tmpDirectory) .fsyncMode(FileCacheStoreConfigurationBuilder.FsyncMode.PER_WRITE); Future<Map<String, Map<ThreadLocal<?>, Object>>> result = fork( new Callable<Map<String, Map<ThreadLocal<?>, Object>>>() { @Override public Map<String, Map<ThreadLocal<?>, Object>> call() throws Exception { EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(builder); try { Cache<Object, Object> c = cm.getCache(); c.put("key", "value"); } finally { TestingUtil.killCacheManagers(cm); Set<Thread> threadSet = Collections.singleton(Thread.currentThread()); Map<String, Map<ThreadLocal<?>, Object>> allThreadLocals = new HashMap<String, Map<ThreadLocal<?>, Object>>(); for (Thread thread : threadSet) { Map<ThreadLocal<?>, Object> threadLocalLeaks = findThreadLocalLeaks(thread); if (threadLocalLeaks != null && !threadLocalLeaks.isEmpty()) allThreadLocals.put(thread.getName(), threadLocalLeaks); } return allThreadLocals; } } }); Map<String, Map<ThreadLocal<?>, Object>> allThreadLocals = result.get(30, TimeUnit.SECONDS); if (!allThreadLocals.isEmpty()) throw new IllegalStateException("Thread locals still present: " + allThreadLocals); }

Target:
public void testCheckThreadLocalLeaks() throws Exception { final ConfigurationBuilder builder = new ConfigurationBuilder(); builder .eviction().strategy(EvictionStrategy.LRU).maxEntries(4096) .locking().concurrencyLevel(2048) .loaders().passivation(false).shared(false).preload(true) .addFileCacheStore().location(tmpDirectory) .fsyncMode(FileCacheStoreConfigurationBuilder.FsyncMode.PER_WRITE); Future<Map<String, Map<ThreadLocal<?>, Object>>> result = fork( new Callable<Map<String, Map<ThreadLocal<?>, Object>>>() { @Override public Map<String, Map<ThreadLocal<?>, Object>> call() throws Exception { Thread forkedThread = doStuffWithCache(builder); beforeGC(); System.gc(); Thread.sleep(500); System.gc(); afterGC(); List<Thread> threadSet = Arrays.asList(Thread.currentThread(), forkedThread); Map<String, Map<ThreadLocal<?>, Object>> allThreadLocals = new HashMap<String, Map<ThreadLocal<?>, Object>>(); for (Thread thread : threadSet) { Map<ThreadLocal<?>, Object> threadLocalLeaks = findThreadLocalLeaks(thread); if (threadLocalLeaks != null && !threadLocalLeaks.isEmpty()) allThreadLocals.put(thread.getName(), threadLocalLeaks); } return allThreadLocals; } }); Map<String, Map<ThreadLocal<?>, Object>> allThreadLocals = result.get(30, TimeUnit.SECONDS); if (!allThreadLocals.isEmpty()) throw new IllegalStateException("Thread locals still present: " + allThreadLocals); }
Source:
private EntityNameResolver createEntityNamesResolver(MediaType mediaType) { if (mediaType.match(APPLICATION_PROTOSTREAM)) { return new ProtobufEntityNameResolver(serCtx); } else { ClassLoader classLoader = cr.getGlobalComponentRegistry().getComponent(ClassLoader.class); ReflectionEntityNamesResolver reflectionEntityNamesResolver = new ReflectionEntityNamesResolver(classLoader); return reflectionEntityNamesResolver; } }

Target:
private EntityNameResolver createEntityNamesResolver(MediaType mediaType) { if (mediaType.match(APPLICATION_PROTOSTREAM)) { return new ProtobufEntityNameResolver(serCtx); } else { ClassLoader classLoader = cr.getGlobalComponentRegistry().getComponent(ClassLoader.class); ReflectionEntityNamesResolver reflectionEntityNamesResolver = new ReflectionEntityNamesResolver(classLoader); if (searchMapping != null) { QueryInterceptor queryInterceptor = cr.getComponent(QueryInterceptor.class); Map<String, Class<?>> indexedEntities = queryInterceptor.indexedEntities(); return name -> { Class<?> c = indexedEntities.get(name); if (c == null) { c = reflectionEntityNamesResolver.resolve(name); } return c; }; } return reflectionEntityNamesResolver; } }
Source:
protected void executeCommand() { int selectedId = 1; List<Integer> map = LinqUtils.foreach(vds_spm_id_mapList, new Function<vds_spm_id_map, Integer>() { @Override public Integer eval(vds_spm_id_map vds_spm_id_map) { return vds_spm_id_map.getvds_spm_id(); } }); Collections.sort(map); for (int id : map) { if (selectedId == id) { selectedId++; } else { break; } } vds_spm_id_map newMap = new vds_spm_id_map(getVds().getstorage_pool_id(), getVdsId(), selectedId); DbFacade.getInstance().getVdsSpmIdMapDao().save(newMap); if (getParameters().isCompensationEnabled()) { getCompensationContext().snapshotNewEntity(newMap); getCompensationContext().stateChanged(); } setSucceeded(true); }

Target:
protected void executeCommand() { int selectedId = 1; List<Integer> list = LinqUtils.foreach(vds_spm_id_mapList, new Function<vds_spm_id_map, Integer>() { @Override public Integer eval(vds_spm_id_map vds_spm_id_map) { return vds_spm_id_map.getvds_spm_id(); } }); Collections.sort(list); for (int id : list) { if (selectedId == id) { selectedId++; } else { break; } } vds_spm_id_map newMap = new vds_spm_id_map(getVds().getstorage_pool_id(), getVdsId(), selectedId); DbFacade.getInstance().getVdsSpmIdMapDao().save(newMap); if (getParameters().isCompensationEnabled()) { getCompensationContext().snapshotNewEntity(newMap); getCompensationContext().stateChanged(); } setSucceeded(true); }
Source:
public StorageQueryExecutor(final ExecutionGraphNode node) { super(node); if (node.getDefaultConfig() == null) { throw new IllegalArgumentException("Default config cannot be null."); } if (node.graph() == null) { throw new IllegalStateException("Execution graph cannot be null."); } if (Strings.isNullOrEmpty(((Config) node.getDefaultConfig()).getStorageId())) { throw new IllegalArgumentException("Default storage ID must be non-empty."); } data_store = (TimeSeriesDataStore) node.graph().tsdb().getRegistry() .getPlugin(TimeSeriesDataStore.class, ((Config) node.getDefaultConfig()).getStorageId()); if (data_store == null) { throw new IllegalStateException("No data store found for ID " + ((Config) node.getDefaultConfig()).getStorageId()); } }

Target:
public StorageQueryExecutor(final ExecutionGraphNode node) { super(node); if (Strings.isNullOrEmpty(((Config) node.getDefaultConfig()).getStorageId())) { throw new IllegalArgumentException("Default storage ID must be non-empty."); } try { data_store = (TimeSeriesDataStore) node.graph().tsdb().getRegistry() .getPlugin(TimeSeriesDataStore.class, ((Config) node.getDefaultConfig()).getStorageId()); if (data_store == null) { throw new IllegalStateException("No data store found for ID " + ((Config) node.getDefaultConfig()).getStorageId()); } } catch (RuntimeException e) { throw new RuntimeException("Unexpected exception initializing " + "storage query executor", e); } }
Source:
private boolean isDepositRecord(Resource bxc3Resc) { PIDs.get(bxc3Resc.toString().toLowerCase()); return bxc3Resc.hasProperty(FedoraProperty.hasModel.getProperty(), ContentModel.DEPOSIT_RECORD.getResource()); }

Target:
private boolean isDepositRecord(Resource bxc3Resc) { return bxc3Resc.hasProperty(FedoraProperty.hasModel.getProperty(), ContentModel.DEPOSIT_RECORD.getResource()); }
Source:
private boolean isMissingData(List<Address> newMembers, List<Address> oldMembers) { int missingMembers = 0; for (Address a : oldMembers) if (!newMembers.contains(a)) missingMembers++; Configuration cacheConfiguration = cache.getCacheConfiguration(); int numOwners = cacheConfiguration.clustering().hash().numOwners(); return missingMembers >= numOwners; }

Target:
private boolean isMissingData(List<Address> newMembers, List<Address> oldMembers) { int missingMembers = 0; for (Address a : oldMembers) if (!newMembers.contains(a)) missingMembers++; int numOwners = configuration.clustering().hash().numOwners(); return missingMembers >= numOwners; }
Source:
public TabletFile(String metadataEntry) { this.metadataPath = new Path(metadataEntry); this.metadataEntry = metadataEntry; this.fileName = metadataPath.getName(); Path tabletDirPath = metadataPath.getParent(); this.tabletDir = tabletDirPath.getName(); MetadataSchema.TabletsSection.ServerColumnFamily.validateDirCol(tabletDir); Path tableIdPath = tabletDirPath.getParent(); this.tableId = TableId.of(tableIdPath.getName()); Path volumePath = TabletFileUtil.getVolumeFromFullPath(metadataPath, "tables"); TabletFileUtil.validateVolume(volumePath); this.volume = volumePath.toString(); }

Target:
public TabletFile(String metadataEntry) { this.metadataEntry = Objects.requireNonNull(metadataEntry); String errorMsg = " is missing from tablet file metadata entry: " + metadataEntry; Path metaPath = new Path(metadataEntry); this.fileName = metaPath.getName(); MetadataSchema.TabletsSection.ServerColumnFamily.validateDirCol(fileName); Path tabletDirPath = Objects.requireNonNull(metaPath.getParent(), "Tablet dir" + errorMsg); this.tabletDir = tabletDirPath.getName(); MetadataSchema.TabletsSection.ServerColumnFamily.validateDirCol(tabletDir); Path tableIdPath = Objects.requireNonNull(tabletDirPath.getParent(), "Table ID" + errorMsg); this.tableId = TableId.of(tableIdPath.getName()); MetadataSchema.TabletsSection.ServerColumnFamily.validateDirCol(tableId.canonical()); Path volumePath = Objects.requireNonNull( TabletFileUtil.getVolumeFromFullPath(metaPath, "tables"), "Volume" + errorMsg); this.volume = volumePath.toString(); this.suffix = tableId.canonical() + "/" + tabletDir + "/" + fileName; }
Source:
private void write_int_LSB_0(final int value, final int nofBitsToWrite) { if (nofBitsToWrite == 0) return; if (nofBitsToWrite < 1 || nofBitsToWrite > 32) throw new RuntimeIOException("Expecting 1 to 32 bits."); if (nofBitsToWrite <= 8) write((byte) value, nofBitsToWrite); else { for (int i = nofBitsToWrite - 8; i >= 0; i -= 8) { final byte v = (byte) (value >>> i); writeByte(v); } if (nofBitsToWrite % 8 != 0) { final byte v = (byte) value; write(v, nofBitsToWrite % 8); } } }

Target:
void write_int_LSB_0(final int value, final int nofBitsToWrite) { if (nofBitsToWrite == 0) return; if (nofBitsToWrite < 1 || nofBitsToWrite > 32) throw new RuntimeIOException("Expecting 1 to 32 bits."); if (nofBitsToWrite <= 8) write((byte) value, nofBitsToWrite); else { for (int i = nofBitsToWrite - 8; i >= 0; i -= 8) { final byte v = (byte) (value >>> i); writeByte(v); } if (nofBitsToWrite % 8 != 0) { final byte v = (byte) value; write(v, nofBitsToWrite % 8); } } }
Source:
public CRAMFileReader(final File file, final InputStream is, final ReferenceSource referenceSource) { if (file == null && is == null) throw new NullPointerException( "Either file or input stream is required."); this.file = file; this.is = is; this.referenceSource = referenceSource; getIterator(); }

Target:
public CRAMFileReader(final File file, final InputStream is, final ReferenceSource referenceSource) { if (file == null && is == null) throw new IllegalArgumentException( "Either file or input stream is required."); this.file = file; this.is = is; this.referenceSource = referenceSource; getIterator(); }
Source:
public MultiProvider(final HostProviderFactory factory, final Environment environment, @Assisted final Configuration configuration) { final Set<String> entries = configuration.subKeys(); final Config underlying = configuration.underlying(); for (String key : entries) { if (underlying.getValue(key).valueType() == ConfigValueType.OBJECT) { if (!underlying.hasPath(key + ".type")) { LOGGER.warn() .setMessage("Expected type for host provider") .addData("key", key) .log(); } final Configuration subConfig = configuration.getConfig(key).withFallback(configuration); final Props subProps = factory.create(subConfig, ConfigurationHelper.<Actor>getType(environment, subConfig, "type")); context().actorOf(subProps); } } }

Target:
public MultiProvider(final HostProviderFactory factory, final Environment environment, @Assisted final Configuration configuration) { final Set<String> entries = configuration.subKeys(); final Config underlying = configuration.underlying(); for (String key : entries) { if (underlying.getValue(key).valueType() == ConfigValueType.OBJECT) { if (!underlying.hasPath(key + ".type")) { LOGGER.warn() .setMessage("Expected type for host provider") .addData("key", key) .log(); continue; } final Configuration subConfig = configuration.getConfig(key).withFallback(configuration); final Props subProps = factory.create(subConfig, ConfigurationHelper.getType(environment, subConfig, "type")); context().actorOf(subProps); } } }
Source:
public void stripsXml() throws Exception { final StringWriter out = new StringWriter(); final BufferedWriter writer = new BufferedWriter(out); writer.write("<a>"); writer.newLine(); writer.write("<b/>"); writer.newLine(); writer.write("</a>"); writer.close(); final String actual = out.getBuffer().toString(); MatcherAssert.assertThat( XSLDocument.STRIP.transform( new XMLDocument("<a> <b/> </a>") ).toString(), Matchers.containsString(actual) ); }

Target:
public void stripsXml() throws Exception { MatcherAssert.assertThat( XSLDocument.STRIP.transform( new XMLDocument("<a> <b/> </a>") ).toString(), Matchers.containsString( new StringBuilder() .append("<a>") .append(System.lineSeparator()) .append("<b/>") .append(System.lineSeparator()) .append("</a>") .toString() ) ); }
Source:
protected void doShutdown() { boolean waitForConsumers = false; synchronized (this.consumersMonitor) { if (this.started || this.aborted) { actualShutDown(); waitForConsumers = true; } } if (waitForConsumers) { try { if (this.cancellationLock.await(getShutdownTimeout(), TimeUnit.MILLISECONDS)) { this.logger.info("Successfully waited for consumers to finish."); } else { this.logger.info("Consumers not finished."); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); this.logger.warn("Interrupted waiting for consumers. Continuing with shutdown."); } finally { this.startedLatch = new CountDownLatch(1); this.started = false; this.aborted = false; this.hasStopped = true; } } if (!this.taskSchedulerSet && this.taskScheduler != null) { ((ThreadPoolTaskScheduler) this.taskScheduler).shutdown(); this.taskScheduler = null; } }

Target:
protected void doShutdown() { boolean waitForConsumers = false; synchronized (this.consumersMonitor) { if (this.started || this.aborted) { actualShutDown(); waitForConsumers = true; } } if (waitForConsumers) { try { if (this.cancellationLock.await(getShutdownTimeout(), TimeUnit.MILLISECONDS)) { this.logger.info("Successfully waited for consumers to finish."); } else { this.logger.info("Consumers not finished."); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); this.logger.warn("Interrupted waiting for consumers. Continuing with shutdown."); } finally { this.startedLatch = new CountDownLatch(1); this.started = false; this.aborted = false; this.hasStopped = true; } } }
Source:
public Assignment getAssignment() throws ParseException { String author; Date date; WebElement submit = getDriver().findElement(By.cssSelector("a[href^=\"deliveries\"]")); final List<WebElement> elements = getDriver().findElements(By.tagName("dd")); author = elements.get(0).getText(); date = new SimpleDateFormat("EEEE dd MMMM yyyy k:m", Locale.US).parse(elements.get(1).getText()); return new Assignment(author, date, submit); }

Target:
public Assignment getAssignment() throws ParseException { return new Assignment(getDriver().findElement(By.cssSelector("a[href^=\"deliveries\"]"))); }
Source:
private void handleRegularAccount() { Account selectedAccount = Preferences.getPreferences(this).getAccount(selectedAccountUuid); unreadAccount.setSummary(selectedAccount.getName()); unreadFolderEnabled.setEnabled(true); unreadFolder.setEnabled(true); }

Target:
private void handleRegularAccount() { Account selectedAccount = Preferences.getPreferences(this).getAccount(selectedAccountUuid); String summary = selectedAccount.getDescription(); if (summary == null || summary.isEmpty()) { summary = selectedAccount.getEmail(); } unreadAccount.setSummary(summary); unreadFolderEnabled.setEnabled(true); unreadFolder.setEnabled(true); }
Source:
public void newValue(Observation observation, LwM2mNode value) { Client client = clientRegistry.findByRegistrationId(observation.getRegistrationId()); if (isQueueMode(client.getBindingMode()) && clientStatusTracker.setClientReachable(client.getEndpoint()) && clientStatusTracker.startClientReceiving(client.getEndpoint())) { LOG.debug("Notify from {}. Sending queued requests.", client.getEndpoint()); processingExecutor.execute(newRequestSendingTask(client.getEndpoint())); } }

Target:
public void newValue(Observation observation, LwM2mNode value) { Client client = clientRegistry.findByRegistrationId(observation.getRegistrationId()); if (isQueueMode(client.getBindingMode()) && clientStatusTracker.setClientReachable(client.getEndpoint()) && clientStatusTracker.startClientReceiving(client.getEndpoint())) { if(LOG.isDebugEnabled()) { LOG.debug("Notify from {}. Sending queued requests.", client.getEndpoint()); } processingExecutor.execute(newRequestSendingTask(client.getEndpoint())); } }
Source:
public void insertNoPrimaryKey(long reps) { AllTypes allTypes = new AllTypes(); realm.beginTransaction(); for (long i = 0; i < reps; i++) { realm.insert(allTypes); } realm.commitTransaction(); }

Target:
public void insertNoPrimaryKey(long reps) { AllTypes allTypes = new AllTypes(); for (long i = 0; i < reps; i++) { realm.insert(allTypes); } }
Source:
public void guiClose() { Keyboard.enableRepeatEvents(false); getBaseScreen().initGui(); ClientConfiguration config = LogisticsPipes.getClientPlayerConfig(); try { config.setRenderPipeDistance(renderDistance.getInteger()); config.setRenderPipeContentDistance(contentRenderDistance.getInteger()); } catch (Exception e) { e.printStackTrace(); } MainProxy.sendPacketToServer( PacketHandler.getPacket(PlayerConfigToServerPacket.class).setConfig(config)); }

Target:
public void guiClose() { ClientConfiguration config = LogisticsPipes.getClientPlayerConfig(); try { config.setRenderPipeDistance(renderDistance.getInteger()); config.setRenderPipeContentDistance(contentRenderDistance.getInteger()); } catch (Exception e) { e.printStackTrace(); } MainProxy.sendPacketToServer( PacketHandler.getPacket(PlayerConfigToServerPacket.class).setConfig(config)); }
Source:
public synchronized int read(final byte[] b, final int off, final int len) throws IOException { if (b != null) { LOG.debug("read requested b.length = offset = len = {}", b.length, off, len); } else { LOG.debug("read requested b = null offset = len = {}", off, len); } int currentOff = off; int currentLen = len; int lastReadBytes; int totalReadBytes = 0; if (streamStatistics != null) { streamStatistics.readOperationStarted(off, len); } incrementReadOps(); do { lastReadBytes = readToUserBuffer(b, currentOff, currentLen); if (lastReadBytes > 0) { currentOff += lastReadBytes; currentLen -= lastReadBytes; totalReadBytes += lastReadBytes; } if (currentLen <= 0 || currentLen > b.length - currentOff) { break; } } while (lastReadBytes > 0); return totalReadBytes > 0 ? totalReadBytes : lastReadBytes; }

Target:
public synchronized int read(final byte[] b, final int off, final int len) throws IOException { if (b != null) { LOG.debug("read requested b.length = offset = len = {}", b.length, off, len); } else { LOG.debug("read requested b = null offset = len = {}", off, len); } int currentOff = off; int currentLen = len; int lastReadBytes; int totalReadBytes = 0; if (streamStatistics != null) { streamStatistics.readOperationStarted(off, len); } incrementReadOps(); do { if (shouldReadFully()) { lastReadBytes = readFileCompletely(b, currentOff, currentLen); } else if (shouldReadLastBlock()) { lastReadBytes = readLastBlock(b, currentOff, currentLen); } else { lastReadBytes = readOneBlock(b, currentOff, currentLen); } if (lastReadBytes > 0) { currentOff += lastReadBytes; currentLen -= lastReadBytes; totalReadBytes += lastReadBytes; } if (currentLen <= 0 || currentLen > b.length - currentOff) { break; } } while (lastReadBytes > 0); return totalReadBytes > 0 ? totalReadBytes : lastReadBytes; }
Source:
private int getCurrValidWorkers(Collection<ImmutableWorkerInfo> workers) { final Predicate<ImmutableWorkerInfo> isValidWorker = ProvisioningUtil.createValidWorkerPredicate(config); final int currValidWorkers = Collections2.filter(workers, isValidWorker).size(); log.info("Current valid workers: %d", currValidWorkers); return currValidWorkers; }

Target:
private int getCurrValidWorkers(Collection<ImmutableWorkerInfo> workers) { final Predicate<ImmutableWorkerInfo> isValidWorker = ProvisioningUtil.createValidWorkerPredicate(config); final int currValidWorkers = Collections2.filter(workers, isValidWorker).size(); log.debug("Current valid workers: %d", currValidWorkers); return currValidWorkers; }
Source:
private Map<String, String> getSegmentsMetadataFromServer(String tableNameWithType) throws InvalidConfigException, IOException { LOGGER.trace("Inside getSegmentsMetadataFromServer() entry"); TableMetadataReader tableMetadataReader = new TableMetadataReader(_executor, _connectionManager, _pinotHelixResourceManager); LOGGER.trace("Inside getSegmentsMetadataFromServer() exit"); return tableMetadataReader.getSegmentsMetadata(tableNameWithType, _controllerConf.getServerAdminRequestTimeoutSeconds() * 1000); }

Target:
private JsonNode getSegmentsMetadataFromServer(String tableNameWithType) throws InvalidConfigException, IOException { TableMetadataReader tableMetadataReader = new TableMetadataReader(_executor, _connectionManager, _pinotHelixResourceManager); return tableMetadataReader.getSegmentsMetadata(tableNameWithType, _controllerConf.getServerAdminRequestTimeoutSeconds() * 1000); }
Source:
public SubscribedRepository(PubSubConfig.Subscriber s) throws IOException { remote = s.getRemote(); repository = new FileRepository(s.getDirectory()); specs = s.getSubscribeSpecs(); name = s.getName(); }

Target:
public SubscribedRepository(PubSubConfig.Subscriber s) throws IOException { this(s, new FileRepository(s.getDirectory())); }
Source:
public String getValue() { return String.format( Locale.ROOT, "%d years %d mons %d days %d hours %d mins %f secs", years, months, days, hours, minutes, wholeSeconds + microSeconds / 1e6d ); }

Target:
public String getValue() { return String.format( Locale.ROOT, "%d years %d mons %d days %d hours %d mins %s secs", years, months, days, hours, minutes, new DecimalFormat("0.0#####").format(getSeconds()) ); }
Source:
public ChatComponent addExtra(String string) { $lock.writeLock().lock(); this.extra.add(ChatComponent.create().setText(string)); $lock.writeLock().unlock(); return this; }

Target:
public ChatComponent addExtra(String string) { this.extra.add(ChatComponent.create().setText(string)); return this; }
Source:
public void createProfiles() { List<ExtensionEntry> authnExtensions = ConfigurationLoader.getInstance().getExtensionsByService(AUTHN_SERVICE); List<ExtensionEntry> authzExtensions = ConfigurationLoader.getInstance().getExtensionsByService(AUTHZ_SERVICE); Map<String, ExtensionEntry> authnMap = new HashMap<>(); Map<String, ExtensionEntry> authzMap = new HashMap<>(); if (authnExtensions != null) { for (ExtensionEntry entry : authnExtensions) { authnMap.put(entry.getConfig().getString(AUTHN_PROFILE), entry); } } if (authzExtensions != null) { for (ExtensionEntry entry : authzExtensions) { authzMap.put(entry.getConfig().getString(AUTHZ_PROFILE), entry); } } for (Map.Entry<String, ExtensionEntry> mapEntry : authnMap.entrySet()) { ExtensionEntry authzEntry = authzMap.get(mapEntry.getKey()); if (authzEntry != null) { Directory directory = DirectoryManager.getInstance().parseDirectory(authzEntry.getConfig()); Authenticator authenticator = AuthenticatorManager.getInstance().parseAuthenticator(mapEntry.getValue().getConfig()); AuthenticationProfile profile = new AuthenticationProfile(mapEntry.getKey(), authenticator, directory); profiles.put(mapEntry.getKey(), profile); } } }

Target:
public void createProfiles() throws ConfigurationException { List<ExtensionEntry> authnExtensions = ConfigurationLoader.getInstance().getExtensionsByService(AUTHN_SERVICE); for (ExtensionEntry authnExtension: authnExtensions) { String pluginName = authnExtension.getConfig().getString(AUTHN_AUTHZ_PLUGIN); ExtensionEntry authzExtension = ConfigurationLoader.getInstance().getExtensionByName(pluginName); if (authzExtension == null) { throw new ConfigurationException("The authentication extension " + authnExtension.getName() + " does not have a matching authorization extension"); } Directory directory = DirectoryManager.getInstance().parseDirectory(authzExtension.getConfig()); Authenticator authenticator = AuthenticatorManager.getInstance().parseAuthenticator(authzExtension.getConfig()); if (directory == null) { throw new ConfigurationException("No directory could be obtained for authorization plugin " + authzExtension.getName()); } if (authenticator == null) { throw new ConfigurationException("No authenticator could be obtained for authentication plugin " + authnExtension.getName()); } String profileName = authnExtension.getConfig().getString(AUTHN_PROFILE); if (profileName == null) { throw new ConfigurationException("Profile name could not be obtained from configuration of authentication plugin " + authnExtension.getName()); } AuthenticationProfile profile = new AuthenticationProfile(profileName, authenticator, directory); profiles.put(profileName, profile); } }
Source:
public void writeHeaderOnlyIfNotPresentContentSecurityPolicyHeader(){ this.response = spy(this.response); doReturn(true).when(response).containsHeader(CONTENT_SECURITY_POLICY_HEADER); this.writer.writeHeaders(this.request, this.response); verify(this.response, times(1)).containsHeader(anyString()); verify(this.response, never()).setHeader(anyString(), anyString()); verifyNoMoreInteractions(this.response); }

Target:
public void writeHeaderOnlyIfNotPresentContentSecurityPolicyHeader(){ String value = new String("value"); this.response.setHeader(CONTENT_SECURITY_POLICY_HEADER, value); this.writer.writeHeaders(this.request, this.response); assertThat(this.response.getHeader(CONTENT_SECURITY_POLICY_HEADER)).isSameAs(value); }
Source:
public String toString() { ToStringHelper stringHelper = toStringHelper(this) .add("equiCriteria", this.equiCriteria); if (filter.isPresent()) { stringHelper.add("filter", filter); } return stringHelper.toString(); }

Target:
public String toString() { return toStringHelper(this) .omitNullValues() .add("equiCriteria", equiCriteria) .add("filter", filter.orElse(null)) .toString(); }
Source:
public void BaudRate(int baudRate) { this.baudRate = baudRate; mPhysicaloid.setBaudrate(baudRate); Log.d(LOG_TAG, "Baud Rate: " + baudRate); }

Target:
public void BaudRate(int baudRate) { this.baudRate = baudRate; Log.d(LOG_TAG, "Baud Rate: " + baudRate); if (mPhysicaloid != null) mPhysicaloid.setBaudrate(baudRate); else Log.w(LOG_TAG, "Could not set Serial Baud Rate to " + baudRate + ". Just saved, not applied to serial! Maybe you forgot to initialize it?"); }
Source:
public Response getDeviceOrganizationStateById(@PathParam("deviceId") String deviceId) { if (deviceId.length() <= 0) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } int result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationStateById(deviceId); if (result == -1) { String msg = "Device with ID: " + deviceId + " not found."; log.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving state of device with ID:" + deviceId + " to Device Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { log.error("failed to add operation", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }

Target:
public Response getDeviceOrganizationStateById(@PathParam("deviceId") String deviceId) { if (deviceId.isEmpty()) { String errorMessage = "The parameter of the device organization ID is empty."; return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build(); } int result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); try { result = dops.getDeviceOrganizationStateById(deviceId); if (result == -1) { String msg = "Device with ID: " + deviceId + " not found."; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); } catch (DeviceOrganizationException e) { String msg = "Error occurred while retrieving state of device with ID:" + deviceId + " to Device " + "Organization "; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (InvalidConfigurationException e) { String msg = "failed to add operation"; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } }
Source:
public int hashCode() { return Objects.hash(type, path, localLocation); }

Target:
public int hashCode() { return type + path.hashCode() + localLocation.hashCode(); }
Source:
public static Enum<EnumTarget> getForClass(Class<? extends Target> clazz) { return Arrays.stream(values()).filter(enumTarget -> enumTarget.clazz == clazz).findFirst().orElse(null); }

Target:
public static EnumTarget getForClass(Class<? extends Target> clazz) { return Arrays.stream(values()).filter(enumTarget -> enumTarget.clazz == clazz).findFirst().orElse(null); }
Source:
private void refreshHasSelfRestrictions(final Map<Resource, URI> restrictions) throws QueryEvaluationException { hasSelfByType = new HashMap<>(); hasSelfByProperty = new HashMap<>(); restrictions.forEach((type, property) -> { try { final CloseableIteration<Statement, QueryEvaluationException> iter = RyaDAOHelper.query(ryaDAO, type, HASSELF, null, conf); try { if (iter.hasNext()) { Set<URI> typeSet = hasSelfByType.get(type); Set<Resource> propSet = hasSelfByProperty.get(property); if (typeSet == null) { typeSet = new HashSet<>(); } if (propSet == null) { propSet = new HashSet<>(); } typeSet.add(property); propSet.add(type); hasSelfByType.put(type, typeSet); hasSelfByProperty.put(property, propSet); } } catch (final QueryEvaluationException e) { if (iter != null) { iter.close(); } } } catch (final QueryEvaluationException e) { } }); }

Target:
private void refreshHasSelfRestrictions(final Map<Resource, URI> restrictions) throws QueryEvaluationException { hasSelfByType = new HashMap<>(); hasSelfByProperty = new HashMap<>(); for(final Resource type : restrictions.keySet()) { final URI property = restrictions.get(type); final CloseableIteration<Statement, QueryEvaluationException> iter = RyaDAOHelper.query(ryaDAO, type, HAS_SELF, null, conf); try { if (iter.hasNext()) { Set<URI> typeSet = hasSelfByType.get(type); Set<Resource> propSet = hasSelfByProperty.get(property); if (typeSet == null) { typeSet = new HashSet<>(); } if (propSet == null) { propSet = new HashSet<>(); } typeSet.add(property); propSet.add(type); hasSelfByType.put(type, typeSet); hasSelfByProperty.put(property, propSet); } } finally { if (iter != null) { iter.close(); } } } }
Source:
public FeedbackResponseAttributes(FeedbackResponseAttributes copy) { this.feedbackResponseId = copy.getId(); this.feedbackSessionName = copy.feedbackSessionName; this.courseId = copy.courseId; this.feedbackQuestionId = copy.feedbackQuestionId; this.feedbackQuestionType = copy.feedbackQuestionType; this.giverEmail = copy.giverEmail; this.giverSection = copy.giverSection; this.recipientEmail = copy.recipientEmail; this.recipientSection = copy.recipientSection; this.responseMetaData = copy.responseMetaData; this.createdAt = copy.getCreatedAt(); this.updatedAt = copy.getUpdatedAt(); }

Target:
public FeedbackResponseAttributes(FeedbackResponseAttributes copy) { this.feedbackResponseId = copy.getId(); this.feedbackSessionName = copy.feedbackSessionName; this.courseId = copy.courseId; this.feedbackQuestionId = copy.feedbackQuestionId; this.feedbackQuestionType = copy.feedbackQuestionType; this.giverEmail = copy.giverEmail; this.giverSection = copy.giverSection; this.recipientEmail = copy.recipientEmail; this.recipientSection = copy.recipientSection; this.responseMetaData = copy.responseMetaData; this.createdAt = copy.createdAt; this.updatedAt = copy.updatedAt; }
Source:
protected void processMultiValuedEReference(EReference eReference, SIRIUS processedDescription, SIRIUS currentDescription, TransformationCache cache) { Object processedValue = processedDescription.eGet(eReference); Object currentValue = currentDescription.eGet(eReference); if (currentValue instanceof Iterable<?> && processedValue instanceof Iterable<?>) { List<Object> newValue = new ArrayList<>(); Iterable<?> currentIterable = (Iterable<?>) currentValue; Iterable<?> processedIterable = (Iterable<?>) processedValue; for (Object object : currentIterable) { if (object instanceof EObject) { IDescriptionPreprocessor preprocessor = SiriusPropertiesCorePlugin.getPlugin().getDescriptionPreprocessor((EObject) object); if (preprocessor != null) { EObject processedObject = preprocessor.convert((EObject) object, cache); newValue.add(processedObject); } } } for (Object object : processedIterable) { newValue.add(object); } processedDescription.eSet(eReference, newValue); } }

Target:
protected void processMultiValuedEReference(EReference eReference, SIRIUS processedDescription, SIRIUS currentDescription, TransformationCache cache) { Object processedValue = processedDescription.eGet(eReference); Object currentValue = currentDescription.eGet(eReference); if (currentValue instanceof Iterable<?> && processedValue instanceof Iterable<?>) { List<Object> newValue = new ArrayList<>(); Iterable<?> currentIterable = (Iterable<?>) currentValue; Iterable<?> processedIterable = (Iterable<?>) processedValue; StreamSupport.stream(currentIterable.spliterator(), false).filter(EObject.class::isInstance).map(EObject.class::cast).forEach(object -> { SiriusPropertiesCorePlugin.getPlugin().getDescriptionPreprocessor(object).map(preprocessor -> preprocessor.convert(object, cache)).map(newValue::add); }); processedIterable.forEach(newValue::add); processedDescription.eSet(eReference, newValue); } }
Source:
private static String toHexString(byte b) { char[] hexes = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; StringBuilder hexStringBuilder = new StringBuilder(2); hexStringBuilder.append(hexes[(b & 0xF0) >> 4]); hexStringBuilder.append(hexes[b & 0x0F]); return hexStringBuilder.toString(); }

Target:
private static String toHexString(byte b) { StringBuilder hexStringBuilder = new StringBuilder(2); hexStringBuilder.append(hexes[(b & 0xF0) >> 4]); hexStringBuilder.append(hexes[b & 0x0F]); return hexStringBuilder.toString(); }
Source:
public void process(MetadataRepository repository, ComplexTypeMetadata type, XSDAnnotation annotation, XmlSchemaAnnotationProcessorState state) { if (annotation != null) { EList<Element> appInfoElements = annotation.getApplicationInformation(); for (Element appInfo : appInfoElements) { String source = appInfo.getAttribute("source"); String textContent = appInfo.getTextContent(); if ("X_Hide".equals(source)) { state.getHide().add(textContent); } else if ("X_Write".equals(source)) { state.getAllowWrite().add(textContent); } else if ("X_Deny_Create".equals(source)) { state.getDenyCreate().add(textContent); } else if ("X_Deny_LogicalDelete".equals(source)) { state.getDenyLogicalDelete().add(textContent); } else if ("X_Deny_PhysicalDelete".equals(source)) { state.getDenyPhysicalDelete().add(textContent); } else if ("X_Workflow".equals(source)) { state.getWorkflowAccessRights().add(textContent); } else if ("X_Visible_Rule".equals(source)) { state.setVisibilityRule(textContent); } else if ("X_No_Add".equals(source) || "X_No_Remove".equals(source)) { handleAddOrRemoveRightInfo(repository, state, appInfo); } } } }

Target:
public void process(MetadataRepository repository, ComplexTypeMetadata type, XSDAnnotation annotation, XmlSchemaAnnotationProcessorState state) { if (annotation != null) { EList<Element> appInfoElements = annotation.getApplicationInformation(); for (Element appInfo : appInfoElements) { String source = appInfo.getAttribute("source"); String textContent = appInfo.getTextContent(); if ("X_Hide".equals(source)) { state.getHide().add(textContent); } else if ("X_Write".equals(source)) { state.getAllowWrite().add(textContent); } else if ("X_Deny_Create".equals(source)) { state.getDenyCreate().add(textContent); } else if ("X_Deny_LogicalDelete".equals(source)) { state.getDenyLogicalDelete().add(textContent); } else if ("X_Deny_PhysicalDelete".equals(source)) { state.getDenyPhysicalDelete().add(textContent); } else if ("X_Workflow".equals(source)) { state.getWorkflowAccessRights().add(textContent); } else if ("X_Visible_Rule".equals(source)) { state.setVisibilityRule(textContent); } else if (NO_ADD.equals(source)) { handleAddRightInfo(repository, state, appInfo); } else if (NO_REMOVE.equals(source)) { handleRemoveRightInfo(repository, state, appInfo); } } } }
Source:
private void doInsert(Exchange exchange, String tableName) throws KuduException { KuduClient connection = endpoint.getKuduClient(); KuduTable table = connection.openTable(tableName); Insert insert = table.newInsert(); PartialRow row = insert.getRow(); Map<?, ?> rows = exchange.getIn().getBody(Map.class); for (Map.Entry<?, ?> entry : rows.entrySet()) { String key = (String) entry.getKey(); Object value = entry.getValue(); switch (value.getClass().toString()) { case "class java.lang.String": row.addString(key, (String) value); break; case "class java.lang.Long": row.addLong(key, (long) value); break; case "class java.lang.Integer": row.addInt(key, (int) value); break; case "class java.lang.Double": row.addDouble(key, (double) value); break; case "class java.lang.Float": row.addFloat(key, (float) value); break; default: throw new IllegalArgumentException("The type " + value.getClass().toString() + " is not supported"); } } connection.newSession().apply(insert); }

Target:
private void doInsert(Exchange exchange, String tableName) throws KuduException { KuduClient connection = endpoint.getKuduClient(); KuduTable table = connection.openTable(tableName); Insert insert = table.newInsert(); PartialRow row = insert.getRow(); Map<?, ?> rows = exchange.getIn().getBody(Map.class); for (Map.Entry<?, ?> entry : rows.entrySet()) { row.addObject(entry.getKey().toString(), entry.getValue()); } connection.newSession().apply(insert); }
Source:
String getInstallId() { String hostName = "Unknown"; try { hostName = InetAddress.getLocalHost().getHostName(); } catch (Exception ignore) { } try { String installIdString = hostName + System.getProperty("user.name"); StringBuilder sb = new StringBuilder(); byte[] bytes = installIdString.getBytes(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%02X%s", bytes[i], (i < bytes.length - 1) ? "-" : "")); } return sb.toString(); } catch (Exception e) { return "Unknown"; } }

Target:
String getInstallId() { String hostName = "Unknown"; try { hostName = InetAddress.getLocalHost().getHostName(); } catch (Exception ignore) { } try { String installIdString = hostName + System.getProperty("user.name"); StringBuilder sb = new StringBuilder(); byte[] bytes = installIdString.getBytes(StandardCharsets.UTF_8); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%02X%s", bytes[i], (i < bytes.length - 1) ? "-" : "")); } return sb.toString(); } catch (Exception e) { return "Unknown"; } }
Source:
public static void verifyPartitionTypeSupported(String partitionName, Type type) { if (!(type instanceof DecimalType || BOOLEAN.equals(type) || TINYINT.equals(type) || SMALLINT.equals(type) || INTEGER.equals(type) || BIGINT.equals(type) || DATE.equals(type) || TIMESTAMP.equals(type) || REAL.equals(type) || DOUBLE.equals(type) || type instanceof VarcharType || type instanceof CharType)) { throw new PrestoException(NOT_SUPPORTED, format("Unsupported type [%s] for partition: %s", type, partitionName)); } }

Target:
public static void verifyPartitionTypeSupported(String partitionName, Type type) { if (!isValidPartitionType(type)) { throw new PrestoException(NOT_SUPPORTED, format("Unsupported type [%s] for partition: %s", type, partitionName)); } }
Source:
private Object getDefaultValue(Type type, String value) { switch (type) { case BOOLEAN: return Boolean.valueOf(value); case INTEGER: return Integer.valueOf(value); case DECIMAL: return Double.valueOf(value); } return null; }

Target:
private Object getDefaultValue(Type type, String value) { switch (type) { case BOOLEAN: return Boolean.valueOf(value); case INTEGER: return Integer.valueOf(value); case DECIMAL: return new BigDecimal(value); } return null; }