auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void testArray() throws Exception { if (!getPgJdbcDriver()) { return; } Server server = createPgServer( "-ifNotExists", "-pgPort", "5535", "-pgDaemon", "-key", "pgserver", "mem:pgserver"); try ( Connection conn = DriverManager.getConnection( "jdbc:postgresql://localhost:5535/pgserver", "sa", "sa"); Statement stat = conn.createStatement(); ) { stat.execute("CREATE TABLE test (id int primary key, x1 int array, x2 varchar array)"); stat.execute("INSERT INTO test (id, x1, x2) VALUES (1, ARRAY[2, 3], ARRAY['4', '5'])"); try (ResultSet rs = stat.executeQuery( "SELECT x1, x2 FROM test WHERE id = 1")) { assertTrue(rs.next()); Object[] arr = (Object[]) rs.getArray(1).getArray(); assertEquals("2", arr[0]); assertEquals("3", arr[1]); arr = (Object[]) rs.getArray(2).getArray(); assertEquals("4", arr[0]); assertEquals("5", arr[1]); } } finally { server.stop(); } }

Target:
private void testArray() throws Exception { if (!getPgJdbcDriver()) { return; } Server server = createPgServer( "-ifNotExists", "-pgPort", "5535", "-pgDaemon", "-key", "pgserver", "mem:pgserver"); try ( Connection conn = DriverManager.getConnection( "jdbc:postgresql://localhost:5535/pgserver", "sa", "sa"); Statement stat = conn.createStatement(); ) { stat.execute("CREATE TABLE test (id int primary key, x1 varchar array)"); stat.execute("INSERT INTO test (id, x1) VALUES (1, ARRAY['abc', 'd\\\"e', '{,}'])"); try (ResultSet rs = stat.executeQuery( "SELECT x1 FROM test WHERE id = 1")) { assertTrue(rs.next()); Object[] arr = (Object[]) rs.getArray(1).getArray(); assertEquals("abc", arr[0]); assertEquals("d\\\"e", arr[1]); assertEquals("{,}", arr[2]); } } finally { server.stop(); } }
Source:
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if( method.isAnnotationPresent(QueryHandler.class)) result.set(true); }

Target:
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (method.isAnnotationPresent(QueryHandler.class)) { result.set(true); } }
Source:
public Optional<SneakingData> fill(DataHolder dataHolder, SneakingData manipulator, MergeFunction overlap) { if (dataHolder instanceof Entity) { final Optional<SneakingData> oldData = from(dataHolder); final SneakingData newData = checkNotNull(overlap, "Merge function was null!").merge(oldData.orNull(), manipulator); final Value<Boolean> newValue = newData.sneaking(); return Optional.of(manipulator.set(newValue)); } return Optional.absent(); }

Target:
public Optional<SneakingData> fill(DataHolder dataHolder, SneakingData manipulator, MergeFunction overlap) { if (dataHolder instanceof Entity) { final Optional<SneakingData> oldData = from(dataHolder); final SneakingData newData = checkNotNull(overlap, "Merge function was null!").merge(manipulator, oldData.orNull()); final Value<Boolean> newValue = newData.sneaking(); return Optional.of(manipulator.set(newValue)); } return Optional.absent(); }
Source:
public boolean remove(Run run) throws IOException { if (run.isDeletable()) { currentSession().delete(run); Run testIfExists = get(run.getId()); return testIfExists == null; } else { return false; } }

Target:
public boolean remove(Run run) throws IOException { if (run.isDeletable()) { Long runId = run.getId(); currentSession().delete(run); Run testIfExists = get(runId); return testIfExists == null; } else { return false; } }
Source:
private void stowMetaDataAndBulkData(File file) { Attributes metadata; if (mediaType == StowMetaDataType.JSON) { try { metadata = parseJSON(file.getPath()); } catch (Exception e) { LOG.error("error parsing metadata JSON file {}: {}", file, e.getMessage()); e.printStackTrace(); return; } } else if (mediaType == StowMetaDataType.XML) { metadata = new Attributes(); try { ContentHandlerAdapter ch = new ContentHandlerAdapter(metadata); SAXParserFactory.newInstance().newSAXParser().parse(file, ch); Attributes fmi = ch.getFileMetaInformation(); if (fmi != null) metadata.addAll(fmi); } catch (Exception e) { LOG.error("error parsing metadata XML file {}: {}", file, e.getMessage()); e.printStackTrace(); return; } } else { throw new IllegalArgumentException("Unsupported media type " + mediaType); } ExtractedBulkData extractedBulkData = extractBulkData(metadata); if (isMultiFrame(metadata)) { if (extractedBulkData.pixelDataBulkData.size() > 1) { LOG.error("Compressed multiframe with multiple fragments in file is not supported by STOW-RS in the current DICOM standard (2015b)", file); return; } } if (!extractedBulkData.pixelDataBulkData.isEmpty()) { metadata.setValue(Tag.PixelData, metadata.getVR(Tag.PixelData), new BulkData(null, extractedBulkData.pixelDataBulkDataURI, extractedBulkData.pixelDataBulkData.get(0).bigEndian)); } try { addResponse(sendMetaDataAndBulkData(metadata, extractedBulkData)); } catch (IOException e) { LOG.error("Error for file {}", file, e); } }

Target:
private void stowMetaDataAndBulkData(File file) { Attributes metadata; if (mediaType == StowMetaDataType.JSON) { try { metadata = parseJSON(file.getPath()); } catch (Exception e) { LOG.error("error parsing metadata JSON file {}", file, e); return; } } else if (mediaType == StowMetaDataType.XML) { metadata = new Attributes(); try { ContentHandlerAdapter ch = new ContentHandlerAdapter(metadata); SAXParserFactory.newInstance().newSAXParser().parse(file, ch); Attributes fmi = ch.getFileMetaInformation(); if (fmi != null) metadata.addAll(fmi); } catch (Exception e) { LOG.error("error parsing metadata XML file {}", file, e); return; } } else { throw new IllegalArgumentException("Unsupported media type " + mediaType); } ExtractedBulkData extractedBulkData = extractBulkData(metadata); if (isMultiFrame(metadata)) { if (extractedBulkData.pixelDataBulkData.size() > 1) { LOG.error("Compressed multiframe with multiple fragments in file is not supported by STOW-RS in the current DICOM standard (2015b)", file); return; } } if (!extractedBulkData.pixelDataBulkData.isEmpty()) { metadata.setValue(Tag.PixelData, metadata.getVR(Tag.PixelData), new BulkData(null, extractedBulkData.pixelDataBulkDataURI, extractedBulkData.pixelDataBulkData.get(0).bigEndian)); } try { addResponse(sendMetaDataAndBulkData(metadata, extractedBulkData)); } catch (IOException e) { LOG.error("Error for file {}", file, e); } }
Source:
public void setUp() throws Exception { super.setUp(); when(getQuery().getDbFacade()).thenReturn(dbFacade); when(dbFacade.getVmGuestAgentInterfaceDao()).thenReturn(vmGuestAgentInterfaceDao); }

Target:
public void setUp() throws Exception { super.setUp(); }
Source:
protected ClientEndpoint initEndpoint() { return endpointManager.getEndpoint(connection); }

Target:
private ClientEndpoint initEndpoint() { ClientEndpoint endpoint = endpointManager.getEndpoint(connection); if (endpoint != null) { return endpoint; } return new ClientEndpointImpl(clientEngine, nodeEngine, connection); }
Source:
public URLClassLoader createEngineClassLoader(File engineDirectory) throws IOException { List<File> osgiClasspath = getOsgiBootstrapClasspath(engineDirectory); addToClassPath(osgiClasspath, new File(engineDirectory, OsgiDir.PLUGINS), new WildcardFileFilter("org.eclipse.osgi_*.jar")); getSlf4jJars().forEach(slf4j -> osgiClasspath.add(0, slf4j)); if (maven.log.isDebugEnabled()) { maven.log.debug("Configuring OSGi engine classpath:"); osgiClasspath.stream().forEach(file -> maven.log.debug(" + "+file.getAbsolutePath())); } return new URLClassLoader(toUrls(osgiClasspath)); }

Target:
public URLClassLoader createEngineClassLoader(File engineDirectory) throws IOException { List<File> osgiClasspath = getOsgiBootstrapClasspath(engineDirectory); addToClassPath(osgiClasspath, new File(engineDirectory, OsgiDir.PLUGINS), new WildcardFileFilter("org.eclipse.osgi_*.jar")); osgiClasspath.addAll(0, getSlf4jJars()); if (maven.log.isDebugEnabled()) { maven.log.debug("Configuring OSGi engine classpath:"); osgiClasspath.stream().forEach(file -> maven.log.debug(" + "+file.getAbsolutePath())); } return new URLClassLoader(toUrls(osgiClasspath)); }
Source:
public void create(List<Change> changes, PersonIdent author, String commitMessage, ProgressMonitor monitor) throws OrmException, IOException, CodeReviewNoteCreationException { try { revWalk = new RevWalk(db); inserter = db.newObjectInserter(); if (author != null) { this.author = author; } if (monitor == null) { monitor = NullProgressMonitor.INSTANCE; } NoteMap notes = NoteMap.newEmptyMap(); for (Change c : changes) { monitor.update(1); PatchSet ps = schema.patchSets().get(c.currentPatchSetId()); if (ps == null) { continue; } ObjectId commitId = ObjectId.fromString(ps.getRevision().get()); notes.set(commitId, createNoteContent(c, commitId)); } NotesBranchUtil notesBranchUtil = notesBranchUtilFactory.create(db); notesBranchUtil.commitAllNotes(notes, REFS_NOTES_REVIEW, author, commitMessage); } catch (ConcurrentRefUpdateException e) { throw new CodeReviewNoteCreationException(e); } finally { revWalk.release(); inserter.release(); } }

Target:
public void create(List<Change> changes, PersonIdent author, String commitMessage, ProgressMonitor monitor) throws OrmException, IOException, CodeReviewNoteCreationException { try { revWalk = new RevWalk(db); inserter = db.newObjectInserter(); if (author != null) { this.author = author; } if (monitor == null) { monitor = NullProgressMonitor.INSTANCE; } NoteMap notes = NoteMap.newEmptyMap(); for (Change c : changes) { monitor.update(1); PatchSet ps = schema.patchSets().get(c.currentPatchSetId()); ObjectId commitId = ObjectId.fromString(ps.getRevision().get()); notes.set(commitId, createNoteContent(c, commitId)); } NotesBranchUtil notesBranchUtil = notesBranchUtilFactory.create(db); notesBranchUtil.commitAllNotes(notes, REFS_NOTES_REVIEW, author, commitMessage); } catch (ConcurrentRefUpdateException e) { throw new CodeReviewNoteCreationException(e); } finally { revWalk.release(); inserter.release(); } }
Source:
public boolean hasNoForeignBindings(List<Map<String, Object>> bindings, String exchangeNamePrefix) { if (bindings.size() == 0) { return true; } boolean noForeign = true; for (Map<String, Object> binding : bindings) { if (!("queue".equals(binding.get("destination_type"))) || !((String) binding.get("destination")).startsWith(exchangeNamePrefix)) { noForeign = false; break; } } return noForeign; }

Target:
private boolean hasNoForeignBindings(List<Map<String, Object>> bindings, String exchangeNamePrefix) { if (bindings.size() == 0) { return true; } boolean noForeign = true; for (Map<String, Object> binding : bindings) { if (!("queue".equals(binding.get("destination_type"))) || !((String) binding.get("destination")).startsWith(exchangeNamePrefix)) { noForeign = false; break; } } return noForeign; }
Source:
protected TreeViewer doCreateTreeViewer(Composite cparent, int style) { treeViewer = new LaunchConfigurationViewer(cparent, style); treeViewer.setLabelProvider(new DecoratingLabelProvider(DebugUITools.newDebugModelPresentation(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); treeViewer.setComparator(new WorkbenchViewerComparator()); treeViewer.setContentProvider(new LaunchConfigurationTreeContentProvider(fLaunchGroup.getMode(), cparent.getShell())); treeViewer.addFilter(new LaunchGroupFilter(fLaunchGroup)); treeViewer.setUseHashlookup(true); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); if(fFilters != null) { for (ViewerFilter fFilter : fFilters) { treeViewer.addFilter(fFilter); } } treeViewer.getControl().addHelpListener(new HelpListener() { @Override public void helpRequested(HelpEvent evt) { handleHelpRequest(evt); } }); return treeViewer; }

Target:
protected TreeViewer doCreateTreeViewer(Composite cparent, int style) { treeViewer = new LaunchConfigurationViewer(cparent, style); treeViewer.setLabelProvider(new DecoratingLabelProvider(DebugUITools.newDebugModelPresentation(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); treeViewer.setComparator(new WorkbenchViewerComparator()); treeViewer.setContentProvider(new LaunchConfigurationTreeContentProvider(fLaunchGroup.getMode(), cparent.getShell())); treeViewer.addFilter(new LaunchGroupFilter(fLaunchGroup)); treeViewer.setUseHashlookup(true); treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); if(fFilters != null) { for (ViewerFilter filter : fFilters) { treeViewer.addFilter(filter); } } treeViewer.getControl().addHelpListener(new HelpListener() { @Override public void helpRequested(HelpEvent evt) { handleHelpRequest(evt); } }); return treeViewer; }
Source:
public void addVm(V1VirtualMachine vm) { try { getKubevirtApi().createNamespacedVirtualMachine(vm, vm.getMetadata().getNamespace()); } catch (ApiException e) { KubevirtUtils.auditAuthorizationIssues(e, auditLogDirector, provider); throw new EngineException(EngineError.unexpected, "failed to interact with kubevirt start endpoint"); } }

Target:
public void addVm(V1VirtualMachine vm) { try { getKubevirtApi().createNamespacedVirtualMachine(vm, vm.getMetadata().getNamespace()); } catch (ApiException e) { handleException(e, "failed to interact with kubevirt create namespaced virtual machine endpoint"); } }
Source:
public ValidationResult isUsingScsiReservationValid(VM vm, LunDisk lunDisk) { if (vm == null && Boolean.TRUE.equals(lunDisk.isUsingScsiReservation())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SCSI_RESERVATION_NOT_VALID_FOR_FLOATING_DISK); } if (lunDisk.isUsingScsiReservation() != null && lunDisk.isUsingScsiReservation() && lunDisk.getSgio() == ScsiGenericIO.FILTERED) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SGIO_IS_FILTERED); } return ValidationResult.VALID; }

Target:
public ValidationResult isUsingScsiReservationValid(VM vm, LunDisk lunDisk) { if (vm == null && Boolean.TRUE.equals(lunDisk.isUsingScsiReservation())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SCSI_RESERVATION_NOT_VALID_FOR_FLOATING_DISK); } if (Boolean.TRUE.equals(lunDisk.isUsingScsiReservation()) && lunDisk.getSgio() == ScsiGenericIO.FILTERED) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_SGIO_IS_FILTERED); } return ValidationResult.VALID; }
Source:
private MetricsHub(@Parameter(Parameters.DashboardHostAddress.class) final String hostAddress, @Parameter(Parameters.DashboardPort.class) final int port) { this.workerEvalParams = Collections.synchronizedList(new LinkedList<>()); this.serverEvalParams = Collections.synchronizedList(new LinkedList<>()); if (!hostAddress.isEmpty()) { this.dolphinURL = "http://" + hostAddress + ":" + port + "/"; } else { dolphinURL = ""; } }

Target:
private MetricsHub(@Parameter(Parameters.DashboardHostAddress.class) final String hostAddress, @Parameter(Parameters.DashboardPort.class) final int port) { this.workerEvalParams = Collections.synchronizedList(new LinkedList<>()); this.serverEvalParams = Collections.synchronizedList(new LinkedList<>()); this.dashboardEnabled = !hostAddress.isEmpty(); this.dashboardURL = "http://" + hostAddress + ":" + port + "/"; if (this.dashboardEnabled) { LOG.log(Level.INFO, "Dashboard url: {0}", dashboardURL); } else { LOG.log(Level.INFO, "Dashboard is not in use"); } }
Source:
public void testCollectStatsAvro() throws Exception { methodWatcher.executeUpdate(String.format("create external table t1_avro (col1 int, col2 char(24))" + " STORED AS AVRO LOCATION '%s'", getExternalResourceDirectory()+"t1_avro_test")); int insertCount = methodWatcher.executeUpdate(String.format("insert into t1_avro values (1,'XXXX')," + "(2,'YYYY')," + "(3,'ZZZZ')")); Assert.assertEquals("insertCount is wrong",3,insertCount); ResultSet rs; PreparedStatement ps = spliceClassWatcher.prepareCall("CALL SYSCS_UTIL.COLLECT_TABLE_STATISTICS(?,?,?) "); ps.setString(1, "EXTERNALTABLEIT"); ps.setString(2, "T1_AVRO"); ps.setBoolean(3, true); rs = ps.executeQuery(); rs.next(); Assert.assertEquals("Error with COLLECT_TABLE_STATISTICS for external table","EXTERNALTABLEIT", rs.getString(1)); rs.close(); ResultSet rs2 = methodWatcher.executeQuery("select total_row_count from sys.systablestatistics where schemaname = 'EXTERNALTABLEIT' and tablename = 'T1_AVRO'"); String expected = "TOTAL_ROW_COUNT |\n" + "------------------\n" + " 3 |"; Assert.assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toString(rs2)); rs2.close(); }

Target:
public void testCollectStatsAvro() throws Exception { methodWatcher.executeUpdate(String.format("create external table t1_avro (col1 int, col2 char(24))" + " STORED AS AVRO LOCATION '%s'", getExternalResourceDirectory()+"t1_avro_test")); int insertCount = methodWatcher.executeUpdate(String.format("insert into t1_avro values (1,'XXXX')," + "(2,'YYYY')," + "(3,'ZZZZ')")); Assert.assertEquals("insertCount is wrong",3,insertCount); ResultSet rs; PreparedStatement ps = spliceClassWatcher.prepareCall("CALL SYSCS_UTIL.COLLECT_TABLE_STATISTICS(?,?,?) "); ps.setString(1, "EXTERNALTABLEIT"); ps.setString(2, "T1_AVRO"); ps.setBoolean(3, true); rs = ps.executeQuery(); rs.next(); Assert.assertEquals("Error with COLLECT_TABLE_STATISTICS for external table","EXTERNALTABLEIT", rs.getString(1)); rs.close(); ResultSet rs2 = methodWatcher.executeQuery("select total_row_count from sys.systablestatistics where schemaname = 'EXTERNALTABLEIT' and tablename = 'T1_AVRO'"); String expected = "TOTAL_ROW_COUNT |\n" + "------------------\n" + " 3 |"; Assert.assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toString(rs2)); rs2.close(); ResultSet rs3 = methodWatcher.executeQuery("select * from t1_avro"); Assert.assertEquals("COL1 |COL2 |\n" + "------------\n" + " 1 |XXXX |\n" + " 2 |YYYY |\n" + " 3 |ZZZZ |",TestUtils.FormattedResult.ResultFactory.toString(rs3)); rs3.close(); }
Source:
public Mono<Response<BlockBlobItem>> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length) { return this.stageBlock(base64BlockID, data, length, null); }

Target:
public Mono<VoidResponse> stageBlock(String base64BlockID, Flux<ByteBuf> data, long length) { return this.stageBlock(base64BlockID, data, length, null); }
Source:
public JedisSentinelPool(String masterName, Set<String> sentinels, final GenericObjectPoolConfig poolConfig, final int timeout, final int soTimeout, final String password, final int database, final Boolean isRedisSslEnabled) { this(masterName, sentinels, poolConfig, timeout, soTimeout, password, database, null, isRedisSslEnabled); }

Target:
public JedisSentinelPool(String masterName, Set<String> sentinels, final GenericObjectPoolConfig poolConfig, final int timeout, final int soTimeout, final String password, final int database, final Boolean isRedisSslEnabled) { this(masterName, sentinels, poolConfig, timeout, soTimeout, password, database, null, isRedisSslEnabled, null, null, null); }
Source:
public static String CreateTmpFile(String fileName) { fileName = isFilenameValid(fileName) ? fileName : KEY_FILENAME; File tempFile = getUniqueFile(fileName); try { tempFile.createNewFile(); } catch (IOException e) { System.err.println("Error: " + e.getMessage()); e.printStackTrace(); return ""; } return tempFile.getPath(); }

Target:
public static String CreateTmpFile(String fileName) throws IOException { fileName = isFilenameValid(fileName) ? fileName : KEY_FILENAME; File tempFile = getUniqueFile(fileName); tempFile.createNewFile(); return tempFile.getPath(); }
Source:
public static SweepStrategyManager createDefault(KeyValueService kvs) { LoadingCache<TableReference, SweepStrategy> cache = Caffeine.newBuilder() .build(tableRef -> getSweepStrategy(kvs.getMetadataForTable(tableRef))); return tableRef -> { if (cache.estimatedSize() == 0) { cache.putAll(getSweepStrategies(kvs)); } SweepStrategy strategy = cache.get(tableRef); return Preconditions.checkNotNull(strategy, "unknown table", SafeArg.of("tableRef", tableRef)); }; }

Target:
public static SweepStrategyManager createDefault(KeyValueService kvs) { LoadingCache<TableReference, SweepStrategy> cache = Caffeine.newBuilder() .build(tableRef -> getSweepStrategy(kvs.getMetadataForTable(tableRef))); return tableRef -> { if (cache.estimatedSize() == 0) { cache.putAll(getSweepStrategies(kvs)); } return cache.get(tableRef); }; }
Source:
private void createFactionList(){ String[] folderList = getFolderList(); for(int i = 0; i < folderList.length; i++) { File factionFile = new File("modules/" + folderList[i] + "/assets/configs/factions.JSON"); JsonParser parser = new JsonParser(); try { FileReader fileReader = new FileReader(factionFile); JsonArray factionJSON = parser.parse(fileReader).getAsJsonArray(); for(int n = 0; n < factionJSON.size(); n++) { factionName.add(factionJSON.get(n).getAsJsonObject().get("name").toString().replace("\"", "")); factionColor.add(factionJSON.get(n).getAsJsonObject().get("color").toString().replace("\"", "")); factionDisposition.add(factionJSON.get(n).getAsJsonObject().get("disposition").getAsInt()); } } catch (FileNotFoundException e) { e.printStackTrace(); } } }

Target:
private void createFactionList() { for (String modulePath : getModuleSet()) { Json factionJson = Assets.getJson(modulePath); Validator.validate(factionJson.getJsonValue(), modulePath); JSONArray factionJsonArray = factionJson.getJsonValue().getJSONArray("factions"); for (int n = 0; n < factionJsonArray.length(); n++) { factionName.add(factionJsonArray.getJSONObject(n).getString("name").replace("\"", "")); factionColor.add(factionJsonArray.getJSONObject(n).getString("color").replace("\"", "")); factionDisposition.add(factionJsonArray.getJSONObject(n).getInt("disposition")); } } }
Source:
protected Command getAlignCommand(AlignmentRequest request) { Command originalAlignCommand = super.getAlignCommand(request); Point delta = request.getMoveDelta(); if (getHost() instanceof AbstractGraphicalEditPart) { Rectangle locationAndSize = new PrecisionRectangle(((AbstractGraphicalEditPart) getHost()).getFigure().getBounds()); ((AbstractGraphicalEditPart) getHost()).getFigure().translateToAbsolute(locationAndSize); Rectangle newLocationAndSize = request.getTransformedRectangle(locationAndSize); delta = newLocationAndSize.getTopLeft().getTranslated(locationAndSize.getTopLeft().getNegated()); } return originalAlignCommand.chain(new ChangeBendpointsOfEdgesCommand(getHost(), new PrecisionPoint(delta), true)); }

Target:
protected Command getAlignCommand(AlignmentRequest request) { Command originalAlignCommand = super.getAlignCommand(request); Point delta = request.getMoveDelta(); if (getHost() instanceof AbstractGraphicalEditPart) { Rectangle locationAndSize = new PrecisionRectangle(((AbstractGraphicalEditPart) getHost()).getFigure().getBounds()); ((AbstractGraphicalEditPart) getHost()).getFigure().translateToAbsolute(locationAndSize); Rectangle newLocationAndSize = request.getTransformedRectangle(locationAndSize); delta = newLocationAndSize.getTopLeft().getTranslated(locationAndSize.getTopLeft().getNegated()); } CompositeTransactionalCommand ctc = new CompositeTransactionalCommand(TransactionUtil.getEditingDomain(getHost().getModel()), originalAlignCommand.getLabel()); ctc.add(new CommandProxy(originalAlignCommand)); ctc.add(new ChangeBendpointsOfEdgesCommand(getHost(), new PrecisionPoint(delta), true)); return new ICommandProxy(ctc); }
Source:
protected void applyModificationsSync(List<Modification> mods) throws PersistenceException { List<MarshalledEntry> entriesToWrite = new ArrayList<>(); List<Object> keysToDelete = new ArrayList<>(); for (Modification m : mods) { switch (m.getType()) { case STORE: entriesToWrite.add(((Store) m).getStoredValue()); break; case REMOVE: keysToDelete.add(((Remove) m).getKey()); break; default: throw new IllegalArgumentException("Unknown modification type " + m.getType()); } } actual.writeBatch(entriesToWrite); actual.deleteBatch(keysToDelete); }

Target:
protected void applyModificationsSync(List<Modification> mods) throws PersistenceException { actual.writeBatch( () -> StreamSupport.stream(Spliterators.spliterator(mods, Spliterator.NONNULL), false) .filter(m -> m.getType() == Modification.Type.STORE) .map(Store.class::cast) .map(Store::getStoredValue) .iterator() ); actual.deleteBatch( () -> StreamSupport.stream(Spliterators.spliterator(mods, Spliterator.NONNULL), false) .filter(m -> m.getType() == Modification.Type.REMOVE) .map(Remove.class::cast) .map(Remove::getKey) .iterator() ); }
Source:
public Map<String, RestTag> list(@Context final HttpServletRequest request, @QueryParam("name") final String tagName, @QueryParam("siteOrFolder") final String siteOrFolderId) { final InitDataObject initDataObject = this.webResource.init (null, true, request, true, null); final User user = initDataObject.getUser(); List<Tag> tags; if(UtilMethods.isSet(tagName)) { tags = searchTagsInternal(tagName, siteOrFolderId, user); } else { tags = getTagsInternal(); } Map<String, RestTag> hash = Maps.newHashMapWithExpectedSize(tags.size()); TagTransform transform = new TagTransform(); for (Tag tag : tags) { hash.put(tag.getTagName(), transform.appToRest(tag)); } return hash; }

Target:
public Map<String, RestTag> list(@Context final HttpServletRequest request, @QueryParam("name") final String tagName, @QueryParam("siteOrFolder") final String siteOrFolderId) { final InitDataObject initDataObject = this.webResource.init (null, true, request, true, null); final User user = initDataObject.getUser(); List<Tag> tags = UtilMethods.isSet(tagName) ? searchTagsInternal(tagName, siteOrFolderId, user) : getTagsInternal(); final Map<String, RestTag> hash = Maps.newHashMapWithExpectedSize(tags.size()); final TagTransform transform = new TagTransform(); for (final Tag tag : tags) { hash.put(tag.getTagName(), transform.appToRest(tag)); } return hash; }
Source:
public void queryLogRotation() throws Exception { final File logsDirectory = new File( testDirectory.graphDbDir(), "logs" ); GraphDatabaseService database = databaseBuilder.setConfig( GraphDatabaseSettings.log_queries, Settings.TRUE ) .setConfig( GraphDatabaseSettings.logs_directory, logsDirectory.getPath() ) .setConfig( GraphDatabaseSettings.log_queries_rotation_threshold, "1" ) .newGraphDatabase(); for ( int i = 0; i < 100; i++ ) { database.execute( QUERY ); } database.shutdown(); File[] queryLogs = fileSystem.get().listFiles( logsDirectory, ( dir, name ) -> name.startsWith( "query.log" ) ); assertThat( "Expect to have more then one query log file.", queryLogs.length, greaterThanOrEqualTo( 2 ) ); List<String> loggedQueries = Arrays.stream( queryLogs ) .map( this::readAllLinesSilent ) .flatMap( Collection::stream ) .collect( Collectors.toList() ); assertTrue( "Expected log file to have at least one log entry", loggedQueries.size() >= 1 ); }

Target:
public void queryLogRotation() throws Exception { final File logsDirectory = new File( testDirectory.graphDbDir(), "logs" ); GraphDatabaseService database = databaseBuilder.setConfig( GraphDatabaseSettings.log_queries, Settings.TRUE ) .setConfig( GraphDatabaseSettings.logs_directory, logsDirectory.getPath() ) .setConfig( GraphDatabaseSettings.log_queries_max_archives, "100" ) .setConfig( GraphDatabaseSettings.log_queries_rotation_threshold, "1" ) .newGraphDatabase(); for ( int i = 0; i < 100; i++ ) { database.execute( QUERY ); } database.shutdown(); File[] queryLogs = fileSystem.get().listFiles( logsDirectory, ( dir, name ) -> name.startsWith( "query.log" ) ); assertThat( "Expect to have more then one query log file.", queryLogs.length, greaterThanOrEqualTo( 2 ) ); List<String> loggedQueries = Arrays.stream( queryLogs ) .map( this::readAllLinesSilent ) .flatMap( Collection::stream ) .collect( Collectors.toList() ); assertThat( "Expected log file to have at least one log entry", loggedQueries, hasSize( 100 ) ); }
Source:
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context) { if (context.isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection(); } if (context.isMoreThanOneSelected()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } final int orderId = context.getSingleSelectedRecordId(); final I_C_Order order = orderDAO.getById(OrderId.ofRepoId(orderId)); final Optional<DocTypeId> docTypeId = DocTypeId.optionalOfRepoId(order.getC_DocTypeTarget_ID()); if (docTypeId.isPresent()) { final boolean isSalesProposalOrQuotation = docTypeBL.isSalesProposalOrQuotation(docTypeId.get()); if (!isSalesProposalOrQuotation) { return ProcessPreconditionsResolution.reject(); } } else { ProcessPreconditionsResolution.reject(); } return ProcessPreconditionsResolution.accept(); }

Target:
public ProcessPreconditionsResolution checkPreconditionsApplicable(final @NonNull IProcessPreconditionsContext context) { if (context.isNoSelection()) { return ProcessPreconditionsResolution.rejectBecauseNoSelection(); } if (context.isMoreThanOneSelected()) { return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection(); } final int orderId = context.getSingleSelectedRecordId(); final I_C_Order order = orderDAO.getById(OrderId.ofRepoId(orderId)); final Optional<DocTypeId> docTypeId = DocTypeId.optionalOfRepoId(order.getC_DocTypeTarget_ID()); if (docTypeId.isPresent()) { final boolean isSalesProposalOrQuotation = docTypeBL.isSalesProposalOrQuotation(docTypeId.get()); if (!isSalesProposalOrQuotation) { return ProcessPreconditionsResolution.rejectWithInternalReason("is not sales proposal or quotation"); } } else { return ProcessPreconditionsResolution.rejectWithInternalReason("no C_DocTypeTarget_ID"); } return ProcessPreconditionsResolution.accept(); }
Source:
public void testReadWriteMoney() { assertThat(handle.select("select :money") .bind("money", new PGmoney(1)) .mapTo(PGmoney.class) .findOnly()) .isEqualTo(new PGmoney(1)); assertThat(handle.select("select :moneys") .bind("moneys", new PGmoney[] {new PGmoney(1), new PGmoney(2)}) .mapTo(PGmoney[].class) .findOnly()) .containsExactly(new PGmoney(1), new PGmoney(2)); }

Target:
public void testReadWriteMoney() { Set<String> moneyTypeOnlySupportsUS = new HashSet<>(Arrays.asList("", Locale.US.getCountry())); Assume.assumeTrue(moneyTypeOnlySupportsUS.contains(Locale.getDefault().getCountry())); assertThat(handle.select("select :money") .bind("money", new PGmoney(1)) .mapTo(PGmoney.class) .findOnly()) .isEqualTo(new PGmoney(1)); assertThat(handle.select("select :moneys") .bind("moneys", new PGmoney[] {new PGmoney(1), new PGmoney(2)}) .mapTo(PGmoney[].class) .findOnly()) .containsExactly(new PGmoney(1), new PGmoney(2)); }
Source:
private void InitializeHelpers() { try { for (StorageType storageType : StorageType.values()) { Class<?> actionType = null; String formattedClassName = String.format("%1$s.%2$s%3$s", ACTION_TYPE_PACKAGE, storageType.name(), ACTION_TYPE_CLASS); try { actionType = Class.forName(formattedClassName); } catch (ClassNotFoundException cnfe) { if (storageType != StorageType.ALL && storageType != StorageType.UNKNOWN) log.debugFormat("StorageHelperDirector Error:: the lookup for following class has failed: {0}" , formattedClassName); } if (actionType != null) { Constructor<?> info = actionType.getConstructors()[0]; IStorageHelper currentHelper = (IStorageHelper) info.newInstance(null); _helpers.put(storageType, currentHelper); } } } catch (Exception ex) { log.error("StorageHelperDirector Error:: exception was encountered during InitializeHelpers() execution", ex); throw new ApplicationException("JTODO missing exception", ex); } }

Target:
private void InitializeHelpers() { try { for (StorageType storageType : StorageType.values()) { Class<?> actionType = null; String formattedClassName = String.format("%1$s.%2$s%3$s", ACTION_TYPE_PACKAGE, storageType.name(), ACTION_TYPE_CLASS); try { actionType = Class.forName(formattedClassName); } catch (ClassNotFoundException cnfe) { if (storageType != StorageType.ALL && storageType != StorageType.UNKNOWN) { log.debugFormat("StorageHelperDirector Error:: the lookup for following class has failed: {0}" , formattedClassName); } } if (actionType != null) { Constructor<?> info = actionType.getConstructors()[0]; IStorageHelper currentHelper = (IStorageHelper) info.newInstance(null); _helpers.put(storageType, currentHelper); } } } catch (Exception ex) { log.error("StorageHelperDirector Error:: exception was encountered during InitializeHelpers() execution", ex); throw new ApplicationException("JTODO missing exception", ex); } }
Source:
private boolean containsJavaSource(File dir) { File[] files = dir.listFiles(); for (File file : files) { if (file.isFile() && file.getName().lastIndexOf(".") != -1 && file.getName().substring(file.getName().lastIndexOf(".")).equalsIgnoreCase(".java")) { return true; } else if (file.isDirectory()) { return containsJavaSource(file); } } return false; }

Target:
private boolean containsJavaSource(File dir) { File[] files = dir.listFiles(); for (File file : files) { if (file.isFile() && file.getName().lastIndexOf(".") != -1 && file.getName().toLowerCase().endsWith(".java")) { return true; } else if (file.isDirectory()) { return containsJavaSource(file); } } return false; }
Source:
public void setAssignment(MethodInvocation node) { this.findViewByIdInvocation = node; this.findViewByIdDeclarationFragment = (VariableDeclarationFragment) getFirstAncestorOrNull(node, VariableDeclarationFragment.class); if (this.findViewByIdDeclarationFragment != null) { this.variable = this.findViewByIdDeclarationFragment.getName(); this.findViewByIdAssignment = getAncestor(this.findViewByIdDeclarationFragment, VariableDeclarationStatement.class); this.findViewByIdExpression = this.findViewByIdDeclarationFragment.getInitializer(); } else { this.findViewByIdVariableAssignment = (Assignment) getFirstAncestorOrNull(node, Assignment.class); if (this.findViewByIdVariableAssignment != null) { this.variable = (SimpleName) this.findViewByIdVariableAssignment.getLeftHandSide(); this.findViewByIdAssignment = getAncestor(this.findViewByIdVariableAssignment, ExpressionStatement.class); this.findViewByIdExpression = this.findViewByIdVariableAssignment.getRightHandSide(); } } }

Target:
private boolean setAssignment(MethodInvocation node) { this.findViewByIdInvocation = node; ASTNode ancestor = getFirstAncestorOrNull(node, VariableDeclarationFragment.class, Assignment.class); if (ancestor instanceof VariableDeclarationFragment) { findViewByIdDeclarationFragment = (VariableDeclarationFragment) ancestor; variable = findViewByIdDeclarationFragment.getName(); findViewByIdExpr = findViewByIdDeclarationFragment.getInitializer(); } else if (ancestor instanceof Assignment) { findViewByIdVariableAssignment = (Assignment) ancestor; ASTNode leftSide = findViewByIdVariableAssignment.getLeftHandSide(); if (leftSide.getNodeType() == SIMPLE_NAME) { variable = (SimpleName) leftSide; } else { return false; } findViewByIdExpr = findViewByIdVariableAssignment.getRightHandSide(); } return true; }
Source:
private void handleGo() { privateKeyBadPasswordView.setVisibility(View.INVISIBLE); attemptsRemainingTextView.setVisibility(View.GONE); final String pin = privateKeyPasswordView.getText().toString().trim(); if (wallet.isEncrypted()) { new DeriveKeyTask(backgroundHandler, application.scryptIterationsTarget()) { @Override protected void onSuccess(final KeyParameter encryptionKey, final boolean wasChanged) { if (wasChanged) application.backupWallet(); signAndSendPayment(encryptionKey, pin); } }.deriveKey(wallet, pin); setState(State.DECRYPTING); } else { signAndSendPayment(null); } }

Target:
private void handleGo() { privateKeyBadPasswordView.setVisibility(View.INVISIBLE); attemptsRemainingTextView.setVisibility(View.GONE); final String pin = privateKeyPasswordView.getText().toString().trim(); if (pinRetryController.isLocked()) { return; } if (wallet.isEncrypted()) { new DeriveKeyTask(backgroundHandler, application.scryptIterationsTarget()) { @Override protected void onSuccess(final KeyParameter encryptionKey, final boolean wasChanged) { if (wasChanged) application.backupWallet(); signAndSendPayment(encryptionKey, pin); } }.deriveKey(wallet, pin); setState(State.DECRYPTING); } else { signAndSendPayment(null, pin); } }
Source:
public void deserialize(ConsumerRecord<byte[], byte[]> record, Collector<RowData> collector) throws Exception { if (keyDeserialization == null && !hasMetadata) { valueDeserialization.deserialize(record.value(), collector); return; } if (keyDeserialization != null) { keyDeserialization.deserialize(record.key(), keyCollector); } outputCollector.inputRecord = record; outputCollector.physicalKeyRows = keyCollector.buffer; outputCollector.outputCollector = collector; if (record.value() != null) { valueDeserialization.deserialize(record.value(), outputCollector); } else { outputCollector.collect(null); } keyCollector.buffer.clear(); }

Target:
public void deserialize(ConsumerRecord<byte[], byte[]> record, Collector<RowData> collector) throws Exception { if (keyDeserialization == null && !hasMetadata) { valueDeserialization.deserialize(record.value(), collector); return; } if (keyDeserialization != null) { keyDeserialization.deserialize(record.key(), keyCollector); } outputCollector.inputRecord = record; outputCollector.physicalKeyRows = keyCollector.buffer; outputCollector.outputCollector = collector; if (record.value() == null && upsertMode) { outputCollector.collect(null); } else { valueDeserialization.deserialize(record.value(), outputCollector); } keyCollector.buffer.clear(); }
Source:
private IProject getSingleProject() { IProject result= null; for (IJavaElement fJavaElement : fJavaElements) { if (result == null) { result= fJavaElement.getJavaProject().getProject(); } else if (!result.equals(fJavaElement.getJavaProject().getProject())) { return null; } } return result; }

Target:
private IProject getSingleProject() { IProject result= null; for (IJavaElement javaElement : fJavaElements) { if (result == null) { result= javaElement.getJavaProject().getProject(); } else if (!result.equals(javaElement.getJavaProject().getProject())) { return null; } } return result; }
Source:
public final Response createType(@Context final HttpServletRequest req, final String json) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, true, req, true, null); final User user = initData.getUser(); Response response = null; try { List<ContentType> typesToSave = new JsonContentTypeTransformer(json).asList(); List<ContentType> retTypes = new ArrayList<>(); for (ContentType type : typesToSave) { if (UtilMethods.isSet(type.id()) && !UUIDUtil.isUUID(type.id())) { return ExceptionMapperUtil.createResponse(null, "ContentType 'id' if set, should be a uuid"); } retTypes.add(APILocator.getContentTypeAPI(user, true).save(type)); } response = Response.ok(new ResponseEntityView(new JsonContentTypeTransformer(retTypes).mapList())).build(); } catch (DotStateException e) { response = ExceptionMapperUtil.createResponse(null, "Content-type is not valid ("+ e.getMessage() +")"); } catch (DotDataException e) { response = ExceptionMapperUtil.createResponse(null, "Content-type is not valid ("+ e.getMessage() +")"); } catch (Exception e) { response = ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR); } return response; }

Target:
public final Response createType(@Context final HttpServletRequest req, final String json) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, true, req, true, null); final User user = initData.getUser(); Response response = null; try { final List<ContentType> typesToSave = new JsonContentTypeTransformer(json).asList(); final List<ContentType> retTypes = new ArrayList<>(); for (ContentType type : typesToSave) { if (UtilMethods.isSet(type.id()) && !UUIDUtil.isUUID(type.id())) { return ExceptionMapperUtil.createResponse(null, "ContentType 'id' if set, should be a uuid"); } retTypes.add(APILocator.getContentTypeAPI(user, true).save(type)); } response = Response.ok(new ResponseEntityView(new JsonContentTypeTransformer(retTypes).mapList())).build(); } catch (DotStateException e) { response = ExceptionMapperUtil.createResponse(null, "Content-type is not valid ("+ e.getMessage() +")"); } catch (DotDataException e) { response = ExceptionMapperUtil.createResponse(null, "Content-type is not valid ("+ e.getMessage() +")"); } catch (Exception e) { response = ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR); } return response; }
Source:
String getTagType() { return tagType; }

Target:
public String getTagType() { return tagType; }
Source:
private void validate(String accountId, Stack stack, Set<InstanceMetaData> remainingGoodInstances, Set<InstanceMetaData> remainingBadInstances, Collection<InstanceMetaData> instancesToRepair) { if (!entitlementService.freeIpaHaEnabled(INTERNAL_ACTOR_CRN, accountId)) { throw new BadRequestException("The FreeIPA HA capability is disabled."); } if (instancesToRepair.isEmpty()) { throw new NotFoundException("No unhealthy instances to repair. Maybe use the force option."); } if (remainingGoodInstances.isEmpty()) { throw new BadRequestException("At least one instance must remain running with a good status during a repair."); } if (!remainingBadInstances.isEmpty()) { String errorMsg = "At least one remaining non-repaired instance has a bad status. All remaining instances must have a good status during a repair."; LOGGER.error("{}. The following instances have a bad status: [{}]", errorMsg, remainingBadInstances); throw new BadRequestException(errorMsg); } if (stack.getInstanceGroups().isEmpty()) { throw new BadRequestException("At least one instace group must be present for a repair."); } }

Target:
private void validate(String accountId, Stack stack, Set<InstanceMetaData> remainingGoodInstances, Set<InstanceMetaData> remainingBadInstances, Collection<InstanceMetaData> instancesToRepair) { LOGGER.debug("Validating repair for account and stack ID {}. Remaining good instances [{}]. Remaining bad instances [{}]. Instances to repair [{}].", accountId, stack.getId(), remainingGoodInstances, remainingBadInstances, instancesToRepair); if (!entitlementService.freeIpaHaEnabled(INTERNAL_ACTOR_CRN, accountId)) { throw new BadRequestException("The FreeIPA HA capability is disabled."); } if (instancesToRepair.isEmpty()) { throw new NotFoundException("No unhealthy instances to repair. Maybe use the force option."); } if (remainingGoodInstances.isEmpty()) { throw new BadRequestException("At least one instance must remain running with a good status during a repair."); } if (!remainingBadInstances.isEmpty()) { String errorMsg = "At least one remaining non-repaired instance has a bad status. All remaining instances must have a good status during a repair."; LOGGER.error("{}. The following instances have a bad status: [{}]", errorMsg, remainingBadInstances); throw new BadRequestException(errorMsg); } if (stack.getInstanceGroups().isEmpty()) { throw new BadRequestException("At least one instace group must be present for a repair."); } }
Source:
protected boolean canDoAction() { VmHandler.updateDisksFromDb(getVm()); Collection<DiskImage> diskImages = ImagesHandler.filterImageDisks(getVm().getDiskMap().values(), false, true); DiskImage vmDisk = LinqUtils.first(diskImages); boolean result = true; Snapshot snapshot = getSnapshotDao().get(getParameters().getDstSnapshotId()); SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); VmValidator vmValidator = new VmValidator(getVm()); result = result && validate(snapshotsValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotsValidator.snapshotExists(snapshot)) && validate(snapshotsValidator.snapshotNotBroken(snapshot)) && validate(vmValidator.vmDown()); if (vmDisk != null) { result = result && ImagesHandler.PerformImagesChecks(getVm(), getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, false, false, true, false, true, true, getVm().getDiskMap().values()); } if (result && LinqUtils.foreach(diskImages, new Function<DiskImage, Guid>() { @Override public Guid eval(DiskImage disk) { return disk.getvm_snapshot_id().getValue(); } }).contains(getParameters().getDstSnapshotId())) { result = false; addCanDoActionMessage(VdcBllMessages.CANNOT_PREIEW_CURRENT_IMAGE); } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__PREVIEW); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT); } return result; }

Target:
protected boolean canDoAction() { updateVmDisksFromDb(); Collection<DiskImage> diskImages = ImagesHandler.filterImageDisks(getVm().getDiskMap().values(), false, true); DiskImage vmDisk = LinqUtils.first(diskImages); Snapshot snapshot = getSnapshotDao().get(getParameters().getDstSnapshotId()); SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); VmValidator vmValidator = new VmValidator(getVm()); boolean result = validate(vmValidator.vmDown()) && validate(snapshotsValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotsValidator.snapshotExists(snapshot)) && validate(snapshotsValidator.snapshotNotBroken(snapshot)); if (vmDisk != null) { result = result && ImagesHandler.PerformImagesChecks(getVm(), getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, false, false, true, false, true, true, getVm().getDiskMap().values()); } if (result && LinqUtils.foreach(diskImages, new Function<DiskImage, Guid>() { @Override public Guid eval(DiskImage disk) { return disk.getvm_snapshot_id().getValue(); } }).contains(getParameters().getDstSnapshotId())) { result = false; addCanDoActionMessage(VdcBllMessages.CANNOT_PREIEW_CURRENT_IMAGE); } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__PREVIEW); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT); } return result; }
Source:
public void testCollections() { SettableConfig config = new DefaultSettableConfig(); config.setProperty("list", "5,4,3,2,1"); config.setProperty("set", "5,4,3,2,1"); config.setProperty("sortedSet", "5,4,3,2,1"); config.setProperty("linkedList", "5,4,3,2,1"); PropertyFactory factory = DefaultPropertyFactory.from(config); ConfigProxyFactory proxy = new ConfigProxyFactory(config, config.getDecoder(), factory); ConfigWithCollections withCollections = proxy.newProxy(ConfigWithCollections.class); Assert.assertEquals(Arrays.asList(5,4,3,2,1), new ArrayList<>(withCollections.getLinkedList())); Assert.assertEquals(Arrays.asList(5,4,3,2,1), new ArrayList<>(withCollections.getList())); Assert.assertEquals(Arrays.asList(5,4,3,2,1), new ArrayList<>(withCollections.getSet())); Assert.assertEquals(Arrays.asList(1,2,3,4,5), new ArrayList<>(withCollections.getSortedSet())); config.setProperty("list", "6,7,8,9,10"); Assert.assertEquals(Arrays.asList(6,7,8,9,10), new ArrayList<>(withCollections.getList())); }

Target:
public void testCollections() { SettableConfig config = new DefaultSettableConfig(); config.setProperty("list", "5,4,3,2,1"); config.setProperty("set", "1,2,3,5,4"); config.setProperty("sortedSet", "5,4,3,2,1"); config.setProperty("linkedList", "5,4,3,2,1"); PropertyFactory factory = DefaultPropertyFactory.from(config); ConfigProxyFactory proxy = new ConfigProxyFactory(config, config.getDecoder(), factory); ConfigWithCollections withCollections = proxy.newProxy(ConfigWithCollections.class); Assert.assertEquals(Arrays.asList(5,4,3,2,1), new ArrayList<>(withCollections.getLinkedList())); Assert.assertEquals(Arrays.asList(5,4,3,2,1), new ArrayList<>(withCollections.getList())); Assert.assertEquals(Arrays.asList(1,2,3,5,4), new ArrayList<>(withCollections.getSet())); Assert.assertEquals(Arrays.asList(1,2,3,4,5), new ArrayList<>(withCollections.getSortedSet())); config.setProperty("list", "6,7,8,9,10"); Assert.assertEquals(Arrays.asList(6,7,8,9,10), new ArrayList<>(withCollections.getList())); }
Source:
public void onPlayerTeleport(PlayerTeleportEvent event) { final Player player = event.getPlayer(); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); final Player player = event.getPlayer(); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); double teleportX = event.getTo().getX(); double teleportZ = event.getTo().getZ(); if(Math.abs(teleportX) >= 30000000 || Math.abs(teleportZ) >= 30000000) { event.setCancelled(true); } if (!TFM_AdminList.isSuperAdmin(player) && playerdata.isFrozen()) { TFM_Util.setFlying(player, true); event.setTo(playerdata.getFreezeLocation()); return; } TFM_AdminWorld.getInstance().validateMovement(event); }

Target:
public void onPlayerTeleport(PlayerTeleportEvent event) { final Player player = event.getPlayer(); final TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); if(Math.abs(event.getTo().getX()) >= 30000000 || Math.abs(event.getTo().getZ()) >= 30000000) { event.setCancelled(true); } if (!TFM_AdminList.isSuperAdmin(player) && playerdata.isFrozen()) { TFM_Util.setFlying(player, true); event.setTo(playerdata.getFreezeLocation()); return; } TFM_AdminWorld.getInstance().validateMovement(event); }