auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Class<?> loadClass(String name, final boolean resolve) throws ClassNotFoundException { int pos = name.lastIndexOf("."); String classPackageName; if (pos > 0) { classPackageName = name.substring(0, pos); } else { classPackageName = name; } ArrayList<ModuleClassLoader> moduleClassLoaders = new ArrayList<ModuleClassLoader>(ModuleFactory .getModuleClassLoaders()); Collections.sort(moduleClassLoaders, new Comparator<ModuleClassLoader>() { @Override public int compare(ModuleClassLoader o1, ModuleClassLoader o2) { return o2.getModule().getPackageName().length() - o1.getModule().getPackageName().length(); } }); for (ModuleClassLoader classLoader : moduleClassLoaders) { boolean tryToLoad = classPackageName.startsWith(classLoader.getModule().getPackageName()); if (!tryToLoad) { for (String providedPackage : classLoader.getAdditionalPackages()) { if (classPackageName.equals(providedPackage)) { tryToLoad = true; break; } } } if (tryToLoad) { try { Class<?> c = classLoader.loadClass(name); loadedClasses.add(c); return c; } catch (ClassNotFoundException e) { } } } ClassNotFoundException ex = null; try { Class<?> c = getParent().loadClass(name); loadedClasses.add(c); return c; } catch (ClassNotFoundException e) { ex = e; } try { Class<?> c = this.findClass(name); return c; } catch (ClassNotFoundException e) { ex = e; } throw ex; }

Target:
public Class<?> loadClass(String name, final boolean resolve) throws ClassNotFoundException { ArrayList<ModuleClassLoader> moduleClassLoaders = new ArrayList<ModuleClassLoader>(ModuleFactory .getModuleClassLoaders()); Class<?> c = loadModuleClass(name, moduleClassLoaders); if (c != null) return c; ClassNotFoundException ex = null; try { c = getParent().loadClass(name); loadedClasses.add(c); return c; } catch (ClassNotFoundException e) { ex = e; } try { c = this.findClass(name); return c; } catch (ClassNotFoundException e) { ex = e; } throw ex; }
Source:
public static HiveSplitSource allAtOnce( ConnectorSession session, String databaseName, String tableName, TupleDomain<? extends ColumnHandle> compactEffectivePredicate, int maxInitialSplits, int maxOutstandingSplits, DataSize maxOutstandingSplitsSize, HiveSplitLoader splitLoader, Executor executor, CounterStat highMemorySplitSourceCounter) { AtomicReference<State> stateReference = new AtomicReference<>(State.initial()); return new HiveSplitSource( session, databaseName, tableName, compactEffectivePredicate, new PerBucket() { private final AsyncQueue<InternalHiveSplit> queue = new AsyncQueue<>(maxOutstandingSplits, executor); @Override public ListenableFuture<?> offer(OptionalInt bucketNumber, InternalHiveSplit connectorSplit) { return queue.offer(connectorSplit); } @Override public ListenableFuture<List<ConnectorSplit>> borrowBatchAsync(OptionalInt bucketNumber, int maxSize, Function<List<InternalHiveSplit>, BorrowResult<InternalHiveSplit, List<ConnectorSplit>>> function) { checkArgument(!bucketNumber.isPresent()); return queue.borrowBatchAsync(maxSize, function); } @Override public void finish() { queue.finish(); } @Override public boolean isFinished(OptionalInt bucketNumber) { checkArgument(!bucketNumber.isPresent()); return queue.isFinished(); } @Override public int rewind(OptionalInt bucketNumber) { throw new UnsupportedOperationException("rewind is not supported for unrewindable split source"); } }, maxInitialSplits, maxOutstandingSplitsSize, splitLoader, stateReference, highMemorySplitSourceCounter); }

Target:
public static HiveSplitSource allAtOnce( ConnectorSession session, String databaseName, String tableName, TupleDomain<? extends ColumnHandle> compactEffectivePredicate, int maxInitialSplits, int maxOutstandingSplits, DataSize maxOutstandingSplitsSize, HiveSplitLoader splitLoader, Executor executor, CounterStat highMemorySplitSourceCounter) { AtomicReference<State> stateReference = new AtomicReference<>(State.initial()); return new HiveSplitSource( session, databaseName, tableName, compactEffectivePredicate, new PerBucket() { private final AsyncQueue<InternalHiveSplit> queue = new AsyncQueue<>(maxOutstandingSplits, executor); @Override public ListenableFuture<?> offer(OptionalInt bucketNumber, InternalHiveSplit connectorSplit) { return queue.offer(connectorSplit); } @Override public ListenableFuture<List<ConnectorSplit>> borrowBatchAsync(OptionalInt bucketNumber, int maxSize, Function<List<InternalHiveSplit>, BorrowResult<InternalHiveSplit, List<ConnectorSplit>>> function) { checkArgument(!bucketNumber.isPresent()); return queue.borrowBatchAsync(maxSize, function); } @Override public void noMoreSplits() { queue.finish(); } @Override public boolean isFinished(OptionalInt bucketNumber) { checkArgument(!bucketNumber.isPresent()); return queue.isFinished(); } @Override public int rewind(OptionalInt bucketNumber) { throw new UnsupportedOperationException("rewind is not supported for non bucketed split source"); } }, maxInitialSplits, maxOutstandingSplitsSize, splitLoader, stateReference, highMemorySplitSourceCounter); }
Source:
@Test void testHashDistributionWithoutKeys() { final RelNode root = createSortPlan(RelDistributions.hash(new ArrayList<>())); final RelJsonWriter writer = new RelJsonWriter(); root.explain(writer); final String json = writer.asString(); assertThat(json, is(XX4)); final String s = deserializeAndDumpToTextFormat(getSchema(root), json); final String expected = "LogicalSortExchange(distribution=[hash], collation=[[0]])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(s, isLinux(expected)); }

Target:
@Test void testHashDistributionWithoutKeys() { final RelNode root = createSortPlan(RelDistributions.hash(Collections.emptyList())); final RelJsonWriter writer = new RelJsonWriter(); root.explain(writer); final String json = writer.asString(); assertThat(json, is(HASH_DIST_WITHOUT_KEYS)); final String s = deserializeAndDumpToTextFormat(getSchema(root), json); final String expected = "LogicalSortExchange(distribution=[hash], collation=[[0]])\n" + " LogicalTableScan(table=[[scott, EMP]])\n"; assertThat(s, isLinux(expected)); }
Source:
private void setBatchStateBackendAndTimerService(StreamGraph graph) { boolean useStateBackend = configuration.get(ExecutionOptions.USE_BATCH_STATE_BACKEND); boolean sortInputs = configuration.get(ExecutionOptions.SORT_INPUTS); checkState( !useStateBackend || sortInputs, "Batch state backend requires the sorted inputs to be enabled!"); if (useStateBackend) { LOG.debug("Using BATCH execution state backend."); graph.setStateBackend(new BatchExecutionStateBackend()); graph.setTimerServiceProvider(BatchExecutionInternalTimeServiceManager::create); } }

Target:
private void setBatchStateBackendAndTimerService(StreamGraph graph) { boolean useStateBackend = configuration.get(ExecutionOptions.USE_BATCH_STATE_BACKEND); boolean sortInputs = configuration.get(ExecutionOptions.SORT_INPUTS); checkState( !useStateBackend || sortInputs, "Batch state backend requires the sorted inputs to be enabled!"); if (useStateBackend) { LOG.debug("Using BATCH execution state backend and timer service."); graph.setStateBackend(new BatchExecutionStateBackend()); graph.setTimerServiceProvider(BatchExecutionInternalTimeServiceManager::create); } else { graph.setStateBackend(stateBackend); } }
Source:
public void initialize() { final Set<MetricTracker> metricTrackerSet = new HashSet<>(1); metricTrackerSet.add(insertableMetricTracker); metricsCollector.registerTrackers(metricTrackerSet); final List<NMFData> dataValues = dataParser.parse(); final List<Long> dataKeys; try { dataKeys = idFactory.getIds(dataValues.size()); } catch (final IdGenerationException e) { throw new RuntimeException(e); } memoryStore.putList(dataKeys, dataValues); final Set<Integer> keys = new HashSet<>(); for (final NMFData datum : dataValues) { for (final Pair<Integer, Double> column : datum.getColumns()) { keys.add(column.getFirst()); } } LOG.log(Level.INFO, "Step size = {0}", stepSize); LOG.log(Level.INFO, "Batch size = {0}", batchSize); LOG.log(Level.INFO, "Total number of keys = {0}", keys.size()); LOG.log(Level.INFO, "Total number of input rows = {0}", dataValues.size()); }

Target:
public void initialize() { final Set<MetricTracker> metricTrackerSet = new HashSet<>(1); metricTrackerSet.add(insertableMetricTracker); metricsCollector.registerTrackers(metricTrackerSet); final List<NMFData> dataValues = dataParser.parse(); final List<Long> dataKeys; try { dataKeys = idFactory.getIds(dataValues.size()); } catch (final IdGenerationException e) { throw new RuntimeException(e); } memoryStore.putList(dataKeys, dataValues); LOG.log(Level.INFO, "Step size = {0}", stepSize); LOG.log(Level.INFO, "Batch size = {0}", batchSize); LOG.log(Level.INFO, "Total number of keys = {0}", getKeys(dataValues)); LOG.log(Level.INFO, "Total number of input rows = {0}", dataValues.size()); }
Source:
public RedisMetadataReport(URL url) { super(url); pool = new JedisPool(new JedisPoolConfig(), url.getHost(), url.getPort(), Protocol.DEFAULT_TIMEOUT, url.getPassword()); }

Target:
public RedisMetadataReport(URL url) { super(url); int timeout = url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT); pool = new JedisPool(new JedisPoolConfig(), url.getHost(), url.getPort(), timeout, url.getPassword()); }
Source:
public void setReason(String reason) { this.reason = reason; }

Target:
void setReason(String reason) { this.reason = reason; }
Source:
private static void initSeverities() { initDefaultSeverities(); initNetworkSeverities(); initImportExportSeverities(); initEngineSeverities(); initVMsPoolSeverities(); initBookmarkSeverities(); initVMSeverities(); initQuotaSeverities(); initTagSeverities(); initClusterSeverities(); initMLASeverities(); initHostSeverities(); initStorageSeverities(); initTaskSeverities(); initGlusterVolumeSeverities(); initDwhSeverities(); initConfigSeverities(); initUserAccountSeverities(); checkSeverities(); initGeneral(); }

Target:
private static void initSeverities() { initDefaultSeverities(); initNetworkSeverities(); initImportExportSeverities(); initEngineSeverities(); initVMsPoolSeverities(); initBookmarkSeverities(); initVMSeverities(); initQuotaSeverities(); initTagSeverities(); initClusterSeverities(); initMLASeverities(); initHostSeverities(); initStorageSeverities(); initTaskSeverities(); initGlusterVolumeSeverities(); initDwhSeverities(); initConfigSeverities(); initUserAccountSeverities(); initCommonSeverities(); checkSeverities(); }
Source:
public void testAuthorizationHeaderIsAdded() { String session = UUID.randomUUID().toString(); accountManager.setUserData(account, AccountGeneral.USER_DATA_SESSION, session); StubFacade facade = new StubFacade(); interceptor.intercept(facade); assertThat(facade.headers).containsKey(ApiRequestInterceptor.HEADER_AUTHORIZATION); String value = facade.headers.get(ApiRequestInterceptor.HEADER_AUTHORIZATION); assertThat(value).isEqualTo("session_token=" + session); }

Target:
public void testAuthorizationHeaderIsAdded() { String session = UUID.randomUUID().toString(); accountManager.setUserData(account, AccountGeneral.USER_DATA_SESSION, session); StubFacade facade = new StubFacade(); interceptor.intercept(facade); assertThat(facade.headers).containsKey(ApiRequestInterceptor.HEADER_AUTHORIZATION); String value = facade.headers.get(ApiRequestInterceptor.HEADER_AUTHORIZATION); assertThat(value).isEqualTo(AuthenticatedRequestInterceptor.SESSION_TOKEN + "=" + session); }
Source:
private static String remoteAddress( Channel channel ) { InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress(); InetAddress address = remoteAddress.getAddress(); String hostAddress = address.getHostAddress(); int port = remoteAddress.getPort(); return format( "%s:%s", hostAddress, port ); }

Target:
private static String remoteAddress( Channel channel ) { try { InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress(); InetAddress address = remoteAddress.getAddress(); String hostAddress = address.getHostAddress(); int port = remoteAddress.getPort(); return format( "%s:%s", hostAddress, port ); } catch ( ClassCastException e ) { SocketAddress remoteAddress = channel.remoteAddress(); return remoteAddress.toString(); } }
Source:
public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { try { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); long[] minTimestampArray = new long[numRowsToDelete]; Arrays.fill(minTimestampArray, Long.MAX_VALUE); Object[] keyOfMinTimestampArray = new Object[numRowsToDelete]; for (Object key: keys) { Object[] data = indexEventHolder.getEvent(key).getOutputData(); long timestamp = (long) data[cachePolicyAttributePosition]; for (int i = 0; i < numRowsToDelete; i++) { if (timestamp < minTimestampArray[i]) { minTimestampArray[i] = timestamp; keyOfMinTimestampArray[i] = key; } } } for (Object deleteKey: keyOfMinTimestampArray) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } catch (ClassCastException e) { log.error(siddhiAppContext + ": " + e.getMessage()); } }

Target:
public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); if (numRowsToDelete >= indexEventHolder.size()) { indexEventHolder.deleteAll(); } else { Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); TreeMap<Long, Object> toDelete = new TreeMap<>(); for (Object key : keys) { if (toDelete.size() < numRowsToDelete) { toDelete.put((Long) indexEventHolder.getEvent(key).getOutputData()[cachePolicyAttributePosition], key); } else { Long timestamp = (Long) indexEventHolder.getEvent(key). getOutputData()[cachePolicyAttributePosition]; Long firstKey = toDelete.firstKey(); if (timestamp < firstKey) { toDelete.remove(firstKey); toDelete.put(timestamp, key); } } } for (Object deleteKey: toDelete.values()) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } }
Source:
protected VDSReturnValue runVdsCommand(VDSCommandType commandType, VDSParametersBase parameters) throws VdcBLLException { parameters.setCorrelationId(getCorrelationId()); return getBackend().getResourceManager().RunVdsCommand(commandType, parameters); }

Target:
protected VDSReturnValue runVdsCommand(VDSCommandType commandType, VDSParametersBase parameters) throws VdcBLLException { return getBackend().getResourceManager().RunVdsCommand(commandType, parameters); }
Source:
public void should_fail_when_asserting_no_exception_raised_but_exception_occurs() { Exception exception = new Exception("boom"); ThrowingCallable boom = raisingException(exception); thrown.expectAssertionError(ShouldNotHaveThrown.shouldNotHaveThrown(exception)); assertThatCode(boom).doesNotThrowAnyException(); }

Target:
public void should_fail_when_asserting_no_exception_raised_but_exception_occurs() { Exception exception = new Exception("boom"); ThrowingCallable boom = raisingException(exception); thrown.expectAssertionError(shouldNotHaveThrown(exception)); assertThatCode(boom).doesNotThrowAnyException(); }
Source:
protected void buildBasicValidationTable() { for (String key : mVerbs.keySet()) { final List<ValueValidationFunction> curList = new java.util.ArrayList<ValueValidationFunction>(); final Class<?> curType = mTypeDict.get(key); if (curType == java.math.BigDecimal.class) { curList.add(validDecimal); } else if (curType == Integer.class) { curList.add(validInteger); } else if (curType == java.util.Date.class) { curList.add(validDateTime); } else if (curType == TimeSpan.class) { curList.add(validTimeSpan); } else { curList.add(validCharacters); } final IConditionValueAutoCompleter tmp = getFieldValueAutoCompleter(key); if (tmp != null) { if (tmp.getClass() == DateEnumValueAutoCompleter.class) { curList.add(validateDateEnumValueByValueAC); } else { curList.add(validateFieldValueByValueAC); } } mValidationDict.put(key, curList); } }

Target:
protected void buildBasicValidationTable() { for (String key : mVerbs.keySet()) { final List<ValueValidationFunction> curList = new ArrayList<ValueValidationFunction>(); final Class<?> curType = mTypeDict.get(key); if (curType == java.math.BigDecimal.class) { curList.add(validDecimal); } else if (curType == Integer.class) { curList.add(validInteger); } else if (curType == Date.class) { curList.add(validDateTime); } else if (curType == TimeSpan.class) { curList.add(validTimeSpan); } else { curList.add(validCharacters); } final IConditionValueAutoCompleter tmp = getFieldValueAutoCompleter(key); if (tmp != null) { if (tmp.getClass() == DateEnumValueAutoCompleter.class) { curList.add(validateDateEnumValueByValueAC); } else { curList.add(validateFieldValueByValueAC); } } mValidationDict.put(key, curList); } }
Source:
private static void makeDataUnitsInteger(final List<OptimizedComputeTask> optimizedComputeTasks, final int totalDataUnits) { int sum = 0; for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (!cmpTask.getParticipateValue()) { continue; } cmpTask.getRequestedDataVariable().setValue( BigDecimal.valueOf(Math.round(cmpTask.getRequestedDataVariable().getValue().doubleValue()))); sum += cmpTask.getRequestedDataValue(); } final int diff = totalDataUnits - sum; for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (!cmpTask.getParticipateValue()) { continue; } if (cmpTask.getRequestedDataValue() + diff >= 0) { cmpTask.getRequestedDataVariable().setValue(BigDecimal.valueOf(cmpTask.getRequestedDataValue() + diff)); return; } } }

Target:
private static void makeDataUnitsInteger(final List<OptimizedComputeTask> optimizedComputeTasks, final int totalDataUnits) { int sum = 0; for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (!cmpTask.getParticipateValue()) { continue; } cmpTask.getRequestedDataVariable().setValue( BigDecimal.valueOf(Math.floor(cmpTask.getRequestedDataVariable().getValue().doubleValue()))); sum += cmpTask.getRequestedDataValue(); } for (final OptimizedComputeTask cmpTask : optimizedComputeTasks) { if (cmpTask.getParticipateValue()) { cmpTask.getRequestedDataVariable().setValue( BigDecimal.valueOf(cmpTask.getRequestedDataValue() + (totalDataUnits - sum))); return; } } }
Source:
public EnumTemperature getTemperature() { return EnumTemperature.getFromValue(ForestryAPI.climateManager.getTemperature(world, pos)); }

Target:
public EnumTemperature getTemperature() { return EnumTemperature.getFromBiome(world.getBiome(pos), world, pos); }
Source:
public static SortedMap<Short, List<MappeableContainer>> groupByKey( ImmutableRoaringBitmap... bitmaps) { Map<Short, List<MappeableContainer>> grouped = new HashMap<>(); for (ImmutableRoaringBitmap bitmap : bitmaps) { MappeableContainerPointer it = bitmap.highLowContainer.getContainerPointer(); while (null != it.getContainer()) { MappeableContainer container = it.getContainer(); short key = it.key(); List<MappeableContainer> slice = grouped.computeIfAbsent(key, k -> new ArrayList<>()); slice.add(container); it.advance(); } } SortedMap<Short, List<MappeableContainer>> sorted = new TreeMap<>(BufferUtil::compareUnsigned); sorted.putAll(grouped); return sorted; }

Target:
public static SortedMap<Short, List<MappeableContainer>> groupByKey( ImmutableRoaringBitmap... bitmaps) { Map<Short, List<MappeableContainer>> grouped = new HashMap<>(); for (ImmutableRoaringBitmap bitmap : bitmaps) { MappeableContainerPointer it = bitmap.highLowContainer.getContainerPointer(); while (null != it.getContainer()) { MappeableContainer container = it.getContainer(); Short key = it.key(); List<MappeableContainer> slice = grouped.get(key); if (null == slice) { slice = new ArrayList<>(); grouped.put(key, slice); } slice.add(container); it.advance(); } } SortedMap<Short, List<MappeableContainer>> sorted = new TreeMap<>(BufferUtil::compareUnsigned); sorted.putAll(grouped); return sorted; }
Source:
public final synchronized void addFunctions(List<? extends SqlFunction> functions) { addFunctions(TEMP_DEFAULT_CATALOG, functions); }

Target:
public void addFunctions(List<? extends SqlFunction> functions) { addFunctions(TEMP_DEFAULT_CATALOG, functions); }
Source:
public final Collection<Session> listSessions() throws SubscriptionNotInitializedException, NakadiRuntimeException, ServiceTemporarilyUnavailableException { getLog().info("fetching sessions information"); final List<String> zkSessions; try { zkSessions = getCurator().getChildren().forPath(getSubscriptionPath("/sessions")); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (Exception ex) { throw new NakadiRuntimeException(ex); } return loadDataAsync( zkSessions, key -> getSubscriptionPath("/sessions/" + key), (key, data) -> { try { return deserializeSession(key, data); } catch (final IOException e) { throw new NakadiRuntimeException(e); } }).values(); }

Target:
public final Collection<Session> listSessions() throws SubscriptionNotInitializedException, NakadiRuntimeException, ServiceTemporarilyUnavailableException { getLog().info("fetching sessions information"); final List<String> zkSessions; try { zkSessions = getCurator().getChildren().forPath(getSubscriptionPath("/sessions")); } catch (final KeeperException.NoNodeException e) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (Exception ex) { throw new NakadiRuntimeException(ex); } return loadDataAsync( zkSessions, key -> getSubscriptionPath("/sessions/" + key), this::deserializeSession ).values(); }
Source:
public void getAccountByIdShouldReturnTheAccountWithId() throws Exception { String responseString = "{ \"id\": \"FOOBAR\" }"; MockRestAdapter<Account> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<UpholdRestAdapter, Account>() { @Override public Promise<Account> call(UpholdRestAdapter adapter) { User user = Fixtures.loadUser(); user.setUpholdRestAdapter(adapter); return user.getAccountById("FOOBAR"); } }); Account account = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), String.format("%s/v0/me/accounts/FOOBAR", BuildConfig.API_SERVER_URL)); Assert.assertEquals(account.getId(), "FOOBAR"); }

Target:
public void getAccountByIdShouldReturnTheAccountWithId() throws Exception { String responseString = "{ \"currency\": \"FOO\", \"id\": \"FOOBAR\", \"label\": \"BAR\", \"status\": \"FOO BAR\", \"type\": \"Bar\" }"; MockRestAdapter<Account> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<UpholdRestAdapter, Account>() { @Override public Promise<Account> call(UpholdRestAdapter adapter) { User user = Fixtures.loadUser(); user.setUpholdRestAdapter(adapter); return user.getAccountById("FOOBAR"); } }); Account account = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), String.format("%s/v0/me/accounts/FOOBAR", BuildConfig.API_SERVER_URL)); Assert.assertEquals(account.getCurrency(), "FOO"); Assert.assertEquals(account.getId(), "FOOBAR"); Assert.assertEquals(account.getLabel(), "BAR"); Assert.assertEquals(account.getStatus(), "FOO BAR"); Assert.assertEquals(account.getType(), "Bar"); }
Source:
public String encodeTarget(String target){ target= StringUtils.replace(target,"[", "%5B"); target= StringUtils.replace(target,"]", "%5D"); return target; }

Target:
public String encodeTarget(String target){ try{ return URLEncoder.encode(target, StandardCharsets.UTF_8.toString()); }catch(UnsupportedEncodingException ex){ return target; } }
Source:
public ListBoxModel doFillHardwareIdItems( @QueryParameter String hardwareId, @QueryParameter String endPointUrl, @QueryParameter String identity, @QueryParameter String credential, @QueryParameter String zone ) { ListBoxModel m = new ListBoxModel(); m.add("None specified", ""); final String valueOrEmpty = Util.fixNull(hardwareId); boolean existingValueFound = valueOrEmpty.isEmpty(); try { if (haveServerDetails(endPointUrl, identity, credential, zone)) { final Openstack openstack = Openstack.Factory.get(endPointUrl, identity, credential, zone); for (Flavor flavor : openstack.getSortedFlavors()) { final String value = flavor.getId(); final String displayText = String.format("%s (%s)", flavor.getName(), value); m.add(displayText, value); existingValueFound |= valueOrEmpty.equals(value); } } } catch (AuthenticationException | FormValidation | ConnectionException ex) { LOGGER.log(Level.FINEST, "Openstack call failed", ex); } catch (Exception ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } if (!existingValueFound) { m.add(hardwareId); } return m; }

Target:
public ListBoxModel doFillHardwareIdItems( @QueryParameter String hardwareId, @QueryParameter String endPointUrl, @QueryParameter String identity, @QueryParameter String credential, @QueryParameter String zone ) { ListBoxModel m = new ListBoxModel(); m.add("None specified", ""); final String valueOrEmpty = Util.fixNull(hardwareId); try { if (haveAuthDetails(endPointUrl, identity, credential, zone)) { final Openstack openstack = Openstack.Factory.get(endPointUrl, identity, credential, zone); for (Flavor flavor : openstack.getSortedFlavors()) { final String value = flavor.getId(); final String displayText = String.format("%s (%s)", flavor.getName(), value); m.add(displayText, value); } } } catch (AuthenticationException | FormValidation | ConnectionException ex) { LOGGER.log(Level.FINEST, "Openstack call failed", ex); } catch (Exception ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } if (!hasValue(m, valueOrEmpty)) { m.add(hardwareId); } return m; }
Source:
public void preProcessModule(Module module) { Properties props = new Properties(); ContainerAttributes attributes = getApplicationContext().getBean(ContainerAttributes.class); for (String key : attributes.keySet()) { props.put(ModulePlaceholders.XD_CONTAINER_PREFIX_KEY + key, attributes.get(key)); } module.addProperties(props); }

Target:
public void preProcessModule(Module module) { Properties props = new Properties(); for (String key : attributes.keySet()) { props.setProperty(ModulePlaceholders.XD_CONTAINER_KEY_PREFIX + key, attributes.get(key)); } module.addProperties(props); }
Source:
private boolean shouldRetry(HttpResponse response, int tryCount) { int code = response.statusCode(); return tryCount < maxRetries && (code == 408 || (code >= 500) && code != 501 && code != 505); }

Target:
private boolean shouldRetry(HttpResponse response, int tryCount) { int code = response.statusCode(); return tryCount < maxRetries && (code == HttpURLConnection.HTTP_CLIENT_TIMEOUT || (code >= HttpURLConnection.HTTP_INTERNAL_ERROR && code != HttpURLConnection.HTTP_NOT_IMPLEMENTED && code != HttpURLConnection.HTTP_VERSION)); }
Source:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.priority = args.getPriority(); this.bucketName = args.getBucket(); this.objectName = args.getObjectName(); this.objectPath = FileSystems.getDefault().getPath(this.objectName); this.prefix = args.getPrefix(); this.force = args.isForce(); if (this.sync = args.isSync()) { LOG.info("Using sync command"); } this.numberOfThreads = Integer.valueOf(args.getNumberOfThreads()); this.metadata = args.getMetadata(); return this; }

Target:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.priority = args.getPriority(); this.bucketName = args.getBucket(); this.objectName = args.getObjectName(); this.objectPath = FileSystems.getDefault().getPath(this.objectName); this.prefix = args.getPrefix(); this.force = args.isForce(); this.sync = args.isSync(); if (this.sync) { LOG.info("Using sync command"); } this.numberOfThreads = args.getNumberOfThreads(); this.metadata = args.getMetadata(); return this; }
Source:
public void testCodeSpan() { String html = parser.parseToHtml("Use the `printf()` function."); TestUtil.println("HTML: " + content(html)); assertEquals("<p>Use the <code>printf()</code> function.</p>\n", content(html)); String html3 = parser.parseToHtml("`foo *bar* foo`"); TestUtil.println("HTML: " + content(html3)); assertEquals("<p><code>foo *bar* foo</code></p>\n", content(html3)); }

Target:
public void testCodeSpan() { String html = parseToHtml("Use the `printf()` function."); TestUtil.println("HTML: " + html); assertEquals("<p>Use the <code>printf()</code> function.</p>\n", html); }
Source:
protected Optional<Enchantment> buildContent(DataView container) throws InvalidDataException { checkNotNull(container, "The data view cannot be null!"); if (container.contains(Queries.ENCHANTMENT_ID, Queries.LEVEL)) { final String id = DataUtil.getData(container, Queries.ENCHANTMENT_ID, String.class); final int level = DataUtil.getData(container, Queries.LEVEL, Integer.class); final Optional<EnchantmentType> enchantmentType = SpongeImpl.getRegistry().getType(EnchantmentType.class, id); if (enchantmentType.isPresent()) { return Optional.of(Enchantment.builder().type(enchantmentType.get()).level(level).build()); } } return Optional.empty(); }

Target:
protected Optional<Enchantment> buildContent(DataView container) throws InvalidDataException { checkNotNull(container, "The data view cannot be null!"); if (!container.contains(Queries.ENCHANTMENT_ID, Queries.LEVEL)) { return Optional.empty(); } final String id = DataUtil.getData(container, Queries.ENCHANTMENT_ID, String.class); final int level = DataUtil.getData(container, Queries.LEVEL, Integer.class); final Optional<EnchantmentType> enchantmentType = Sponge.getRegistry().getType(EnchantmentType.class, id); return enchantmentType.map(t -> Enchantment.builder().type(t).level(level).build()); }
Source:
public void createTabs(ILaunchConfigurationDialog dialog, String mode) { setTabs(new AbstractLaunchConfigurationTab[] { new RunImageMainTab(), new RunImageVolumesTab(), new RunImagePortsTab(), new RunImageLinksTab(), new RunImageResourcesTab(), new RunImageEnvironmentTab() }); }

Target:
public void createTabs(ILaunchConfigurationDialog dialog, String mode) { IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); runSelectionModel = null; runVolumesModel = null; if (connections != null && connections.length > 0) { runSelectionModel = new ImageRunSelectionModel(connections[0]); try { runVolumesModel = new ImageRunResourceVolumesVariablesModel( connections[0]); } catch (DockerException e) { } } setTabs(new AbstractLaunchConfigurationTab[] { new RunImageMainTab(runSelectionModel, runVolumesModel), new RunImageVolumesTab(runVolumesModel), new RunImagePortsTab(runSelectionModel), new RunImageLinksTab(runSelectionModel), new RunImageResourcesTab(runVolumesModel), new RunImageEnvironmentTab(runVolumesModel) }); }
Source:
public FrameworkMethod(Method method) { if (method == null) { throw new IllegalArgumentException( "FrameworkMethod cannot be created without an underlying method."); } fMethod = method; }

Target:
public FrameworkMethod(Method method) { if (method == null) { throw new NullPointerException( "FrameworkMethod cannot be created without an underlying method."); } fMethod = method; }
Source:
protected void saveRequestedUrl(final C context, final List<Client> currentClients) throws HttpAction { if (!ajaxRequestResolver.isAjax(context)) { final String requestedUrl = context.getFullRequestURL(); logger.debug("requestedUrl: {}", requestedUrl); context.setSessionAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl); } }

Target:
protected void saveRequestedUrl(final C context, final List<Client> currentClients) throws HttpAction { if (this.saveRequestURLInSession) { final String requestedUrl = context.getFullRequestURL(); logger.debug("requestedUrl: {}", requestedUrl); context.setSessionAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl); } }
Source:
private void postDocumentChanged(final String documentID) { synchronized (lock) { if (!c4DocObservers.containsKey(documentID) || c4db == null) return; Set<DocumentChangeListenerToken> tokens = docListenerTokens.get(documentID); if (tokens != null) { synchronized (tokens) { DocumentChange change = new DocumentChange(documentID); for (DocumentChangeListenerToken token : tokens) token.notify(change); } } } }

Target:
private void postDocumentChanged(final String documentID) { synchronized (lock) { if (!c4DocObservers.containsKey(documentID) || c4db == null) return; Set<DocumentChangeListenerToken> tokens = docListenerTokens.get(documentID); if (tokens != null) { DocumentChange change = new DocumentChange(documentID); for (DocumentChangeListenerToken token : tokens) token.notify(change); } } }
Source:
public void testCreateWithWritePermissions() throws Exception { BaseUser user = server.addUser("test", "password", new WritePermission()); Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "ftp:/ configuration.set("fs.ftp.host", "localhost"); configuration.setInt("fs.ftp.host.port", server.getPort()); configuration.set("fs.ftp.user.localhost", user.getName()); configuration.set("fs.ftp.password.localhost", user.getPassword()); configuration.set("fs.ftp.impl.disable.cache", "true"); FileSystem fs = FileSystem.get(configuration); byte[] bytesExpected = "hello world".getBytes(StandardCharsets.UTF_8); try (FSDataOutputStream outputStream = fs.create(new Path("test1.txt"))) { outputStream.write(bytesExpected); } try (FSDataInputStream input = fs.open(new Path("test1.txt"))) { assertThat(bytesExpected, equalTo(IOUtils.readFullyToByteArray(input))); } }

Target:
public void testCreateWithWritePermissions() throws Exception { BaseUser user = server.addUser("test", "password", new WritePermission()); Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "ftp:/ configuration.set("fs.ftp.host", "localhost"); configuration.setInt("fs.ftp.host.port", server.getPort()); configuration.set("fs.ftp.user.localhost", user.getName()); configuration.set("fs.ftp.password.localhost", user.getPassword()); configuration.setBoolean("fs.ftp.impl.disable.cache", true); FileSystem fs = FileSystem.get(configuration); byte[] bytesExpected = "hello world".getBytes(StandardCharsets.UTF_8); try (FSDataOutputStream outputStream = fs.create(new Path("test1.txt"))) { outputStream.write(bytesExpected); } try (FSDataInputStream input = fs.open(new Path("test1.txt"))) { assertThat(bytesExpected, equalTo(IOUtils.readFullyToByteArray(input))); } }
Source:
public void removeTreeItem() { TerminationTreeItemContent parent = ( treeItem.getParentItem() == null ? this : (TerminationTreeItemContent) treeItem.getParentItem().getUserObject() ); if ( terminationConfigOption == NESTED ) { parent.getModel().getTerminationConfigList().remove( model ); if ( parent.getModel().getTerminationConfigList().isEmpty() ) { parent.getModel().setTerminationConfigList( null ); } } else { terminationOperationMap.get( terminationConfigOption ).removeModelValue(); } parent.getView().addDropDownOption( terminationConfigOption ); treeItem.remove(); terminationConfigForm.displayEmptyTreeLabel( terminationConfigForm.getRootTreeItem().getChildCount() == 0 ); }

Target:
public void removeTreeItem() { TerminationTreeItemContent parent = ( treeItem.getParentItem() == null ? this : (TerminationTreeItemContent) treeItem.getParentItem().getUserObject() ); getTerminationManager( terminationConfigOption ).removeModelValue(); parent.getView().addDropDownOption( terminationConfigOption ); treeItem.remove(); terminationConfigForm.displayEmptyTreeLabel( terminationConfigForm.getRootTreeItem().getChildCount() == 0 ); }
Source:
public void testConvertToLambda28() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); StringBuilder buf= new StringBuilder(); buf.append("package test;\n"); buf.append("public class C1 {\n"); buf.append(" private final String s;\n"); buf.append(" Runnable run = new Runnable() {\n"); buf.append(" @Override\n"); buf.append(" public void run() {\n"); buf.append(" for (int i=0; i < s.length(); ++i) {\n"); buf.append(" int j = i;\n"); buf.append(" }\n"); buf.append(" }\n"); buf.append(" };\n"); buf.append(" public C1() {\n"); buf.append(" s = \"abc\";\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("C1.java", buf.toString(), false, null); int offset= buf.toString().indexOf("new"); AssistContext context= getCorrectionContext(cu, offset, 0); assertNoErrors(context); List<IJavaCompletionProposal> proposals= collectAssists(context, false); assertNumberOfProposals(proposals, 0); }

Target:
public void testConvertToLambda28() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); String buf= "package test;\n" + "public class C1 {\n" + " private final String s;\n" + " Runnable run = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " for (int i=0; i < s.length(); ++i) {\n" + " int j = i;\n" + " }\n" + " }\n" + " };\n" + " public C1() {\n" + " s = \"abc\";\n" + " }\n" + "}\n"; ICompilationUnit cu= pack1.createCompilationUnit("C1.java", buf, false, null); int offset= buf.toString().indexOf("new"); AssistContext context= getCorrectionContext(cu, offset, 0); assertNoErrors(context); List<IJavaCompletionProposal> proposals= collectAssists(context, false); assertNumberOfProposals(proposals, 0); }
Source:
protected void firePropertyChange(String key, Object oldValue, Object newValue) { Object[] allListeners; synchronized(this) { allListeners = listeners.getListeners(); } final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue); for (Object allListener : allListeners) { final IPropertyChangeListener listener = (IPropertyChangeListener) allListener; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { } @Override public void run() throws Exception { listener.propertyChange(event); } }); } }

Target:
protected void firePropertyChange(String key, Object oldValue, Object newValue) { Object[] allListeners; synchronized(this) { allListeners = listeners.getListeners(); } final PropertyChangeEvent event = new PropertyChangeEvent(this, key, oldValue, newValue); for (Object l : allListeners) { final IPropertyChangeListener listener = (IPropertyChangeListener)l; SafeRunner.run(new ISafeRunnable() { @Override public void handleException(Throwable exception) { } @Override public void run() throws Exception { listener.propertyChange(event); } }); } }
Source:
public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent evt) throws Exception { final OslpEnvelope message = (OslpEnvelope) evt.getMessage(); OslpDevice oslpDevice; oslpDevice = null; if (message.getPayloadMessage().hasRegisterDeviceRequest()) { final String deviceIdentification = message.getPayloadMessage().getRegisterDeviceRequest() .getDeviceIdentification(); oslpDevice = this.oslpDeviceSettingsService.getDeviceByDeviceIdentification(deviceIdentification); } else { oslpDevice = this.oslpDeviceSettingsService .getDeviceByUid(Base64.encodeBase64String(message.getDeviceId())); } if (oslpDevice == null) { LOGGER.warn("Received message from unknown device."); } else if (oslpDevice.getPublicKey() == null) { LOGGER.warn("Received message from device without public key: {}", oslpDevice.getDeviceIdentification()); } if (oslpDevice != null && oslpDevice.getPublicKey() != null) { final PublicKey publicKey = CertificateHelper.createPublicKeyFromBase64(oslpDevice.getPublicKey(), this.oslpKeyType, this.oslpSignatureProvider); message.validate(publicKey); } ctx.sendUpstream(evt); }

Target:
public void messageReceived(final ChannelHandlerContext ctx, final MessageEvent evt) throws Exception { final OslpEnvelope message = (OslpEnvelope) evt.getMessage(); OslpDevice oslpDevice; if (message.getPayloadMessage().hasRegisterDeviceRequest()) { final String deviceIdentification = message.getPayloadMessage().getRegisterDeviceRequest() .getDeviceIdentification(); oslpDevice = this.oslpDeviceSettingsService.getDeviceByDeviceIdentification(deviceIdentification); } else { oslpDevice = this.oslpDeviceSettingsService .getDeviceByUid(Base64.encodeBase64String(message.getDeviceId())); } if (oslpDevice == null) { LOGGER.warn("Received message from unknown device."); } else if (oslpDevice.getPublicKey() == null) { LOGGER.warn("Received message from device without public key: {}", oslpDevice.getDeviceIdentification()); } if (oslpDevice != null && oslpDevice.getPublicKey() != null) { final PublicKey publicKey = CertificateHelper.createPublicKeyFromBase64(oslpDevice.getPublicKey(), this.oslpKeyType, this.oslpSignatureProvider); message.validate(publicKey); } ctx.sendUpstream(evt); }
Source:
public ActionResult execute() { String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); CourseAttributes courseAttributes = logic.getCourse(idOfCourseToDelete); logic.deleteCourse(idOfCourseToDelete); return new JsonResult(new CourseData(courseAttributes)); }

Target:
public ActionResult execute() { String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); logic.deleteCourse(idOfCourseToDelete); return new JsonResult(new MessageOutput("OK")); }
Source:
public void testClientScopesPolicyWithPermittedScope() throws Exception { setTrustedHost("localhost"); ClientScopeRepresentation clientTemplate = new ClientScopeRepresentation(); clientTemplate.setName("foo"); Response response = realmResource().clientScopes().create(clientTemplate); String clientTemplateId = ApiUtil.getCreatedId(response); response.close(); ClientRepresentation clientRep = createRep("test-app"); clientRep.setDefaultClientScopes(Collections.singletonList("foo")); assertFail(ClientRegOp.CREATE, clientRep, 403, "Not permitted to use specified clientScope"); ComponentRepresentation clientTemplatesPolicyRep = findPolicyByProviderAndAuth(ClientScopesClientRegistrationPolicyFactory.PROVIDER_ID, getPolicyAnon()); clientTemplatesPolicyRep.getConfig().putSingle(ClientScopesClientRegistrationPolicyFactory.ALLOWED_CLIENT_SCOPES, "foo"); realmResource().components().component(clientTemplatesPolicyRep.getId()).update(clientTemplatesPolicyRep); ClientRepresentation registeredClient = reg.create(clientRep); Assert.assertNotNull(registeredClient.getRegistrationAccessToken()); ApiUtil.findClientResourceByClientId(realmResource(), "test-app").remove(); realmResource().clientScopes().get(clientTemplateId).remove(); }

Target:
public void testClientScopesPolicyWithPermittedScope() throws Exception { setTrustedHost("localhost"); ClientScopeRepresentation clientScope = new ClientScopeRepresentation(); clientScope.setName("foo"); Response response = realmResource().clientScopes().create(clientScope); String clientScopeId = ApiUtil.getCreatedId(response); response.close(); ClientRepresentation clientRep = createRep("test-app"); clientRep.setDefaultClientScopes(Collections.singletonList("foo")); assertFail(ClientRegOp.CREATE, clientRep, 403, "Not permitted to use specified clientScope"); ComponentRepresentation clientScopesPolicyRep = findPolicyByProviderAndAuth(ClientScopesClientRegistrationPolicyFactory.PROVIDER_ID, getPolicyAnon()); clientScopesPolicyRep.getConfig().putSingle(ClientScopesClientRegistrationPolicyFactory.ALLOWED_CLIENT_SCOPES, "foo"); realmResource().components().component(clientScopesPolicyRep.getId()).update(clientScopesPolicyRep); ClientRepresentation registeredClient = reg.create(clientRep); Assert.assertNotNull(registeredClient.getRegistrationAccessToken()); ApiUtil.findClientResourceByClientId(realmResource(), "test-app").remove(); realmResource().clientScopes().get(clientScopeId).remove(); }
Source:
private Optional<OperatingSystem> tryGetOperatingSystemFrom(final String imageId) { Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); return tryFind(from(operatingSystemsAvailable) .filter(new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.getId().contains(imageId); } }), Predicates.notNull()); }

Target:
private Optional<OperatingSystem> tryGetOperatingSystemFrom(final String imageId) { Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); return tryFind(FluentIterable.from(operatingSystemsAvailable) .filter(new Predicate<OperatingSystem>() { @Override public boolean apply(OperatingSystem input) { return input.getId().contains(imageId); } }), Predicates.notNull()); }
Source:
private List<FieldChange> cleanupAllTextFields(BibEntry entry) { return entry.getFields().stream() .filter(field -> !FieldFactory.getNotTextFieldNames().contains(field)) .filter(field -> !field.equals(InternalField.KEY_FIELD)) .flatMap(field -> cleanupSingleField(field, entry).stream()) .collect(Collectors.toList()); }

Target:
private List<FieldChange> cleanupAllTextFields(BibEntry entry) { List<FieldChange> fieldChanges = new ArrayList<>(); Set<Field> fields = new HashSet<>(entry.getFields()); fields.removeAll(FieldFactory.getNotTextFieldNames()); for (Field fieldKey : fields) { if (!fieldKey.equals(InternalField.KEY_FIELD)) { fieldChanges.addAll(cleanupSingleField(fieldKey, entry)); } } return fieldChanges; }
Source:
private SiriusServerDashboardDto getDashboard() { int projectsCount = this.getModelingProjects().mapToInt(e -> 1).sum(); int viewpointsCount = ViewpointRegistry.getInstance().getViewpoints().size(); int metamodelsCount = EPackage.Registry.INSTANCE.size(); List<SiriusServerDashboardProjectDto> projects = this.getModelingProjects() .limit(7) .map(this::convertToProject) .collect(Collectors.toList()); return new SiriusServerDashboardDto(projectsCount, viewpointsCount, metamodelsCount, projects); }

Target:
private SiriusServerDashboardDto getDashboard() { int projectsCount = Long.valueOf(this.getModelingProjects().count()).intValue(); int viewpointsCount = ViewpointRegistry.getInstance().getViewpoints().size(); int metamodelsCount = EPackage.Registry.INSTANCE.size(); List<SiriusServerDashboardProjectDto> projects = this.getModelingProjects() .limit(DASHBOARD_PROJECT_COUNT) .map(this::convertToProject) .collect(Collectors.toList()); return new SiriusServerDashboardDto(projectsCount, viewpointsCount, metamodelsCount, projects); }
Source:
private void draw() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); commonDrawer.begin(); if (solGame != null) { solGame.draw(); } uiDrawer.updateMtx(); inputManager.draw(uiDrawer, this); if (solGame != null) { solGame.drawDebugUi(uiDrawer); factionDisplay.drawFactionNames(solGame, uiDrawer, inputManager, solGame.getObjectManager()); } if (fatalErrorMsg != null) { uiDrawer.draw(UiDrawer.whiteTexture, displayDimensions.getRatio(), .5f, 0, 0, 0, .25f, 0, SolColor.UI_BG); uiDrawer.drawString(fatalErrorMsg, displayDimensions.getRatio(), .5f, FontSize.MENU, true, SolColor.WHITE); uiDrawer.drawString(fatalErrorTrace, .2f * displayDimensions.getRatio(), .6f, FontSize.DEBUG, false, SolColor.WHITE); } DebugCollector.draw(uiDrawer); if (solGame == null) { uiDrawer.drawString("v" + Const.VERSION, 0.01f, .974f, FontSize.DEBUG, UiDrawer.TextAlignment.LEFT, false, SolColor.WHITE); } commonDrawer.end(); }

Target:
private void draw() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); commonDrawer.begin(); if (solGame != null) { solGame.draw(); } uiDrawer.updateMtx(); inputManager.draw(uiDrawer, this); if (solGame != null) { solGame.drawDebugUi(uiDrawer); factionDisplay.drawFactionNames(solGame, uiDrawer, inputManager, solGame.getObjectManager()); } if (fatalErrorMsg != null) { uiDrawer.draw(uiDrawer.whiteTexture, displayDimensions.getRatio(), .5f, 0, 0, 0, .25f, 0, SolColor.UI_BG); uiDrawer.drawString(fatalErrorMsg, displayDimensions.getRatio(), .5f, FontSize.MENU, true, SolColor.WHITE); uiDrawer.drawString(fatalErrorTrace, .2f * displayDimensions.getRatio(), .6f, FontSize.DEBUG, false, SolColor.WHITE); } DebugCollector.draw(uiDrawer); if (solGame == null) { uiDrawer.drawString("v" + Const.VERSION, 0.01f, .974f, FontSize.DEBUG, UiDrawer.TextAlignment.LEFT, false, SolColor.WHITE); } commonDrawer.end(); }