auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testInsertIntoUsingPut() throws Exception { executeString( "CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int4) TABLESPACE cluster1 " + "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b#b')").close(); assertTableExists("hbase_mapped_table"); TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table"); Map<String, String> sessions = new HashMap<>(); sessions.put(HBaseStorageConstants.INSERT_PUT_MODE, "true"); client.updateSessionVariables(sessions); HTable htable = null; ResultScanner scanner = null; try { executeString( "insert into hbase_mapped_table " + "select l_orderkey::text, l_shipdate, l_returnflag, l_suppkey from default.lineitem" ).close(); htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table"); Scan scan = new Scan(); scan.addFamily(Bytes.toBytes("col1")); scan.addFamily(Bytes.toBytes("col2")); scan.addFamily(Bytes.toBytes("col3")); scanner = htable.getScanner(scan); assertStrings(resultSetToString(scanner, new byte[][]{null, Bytes.toBytes("col1"), Bytes.toBytes("col2"), Bytes.toBytes("col3")}, new byte[][]{null, Bytes.toBytes("a"), null, Bytes.toBytes("b")}, new boolean[]{false, false, false, true}, tableDesc.getSchema())); } finally { executeString("DROP TABLE hbase_mapped_table PURGE").close(); List inputList = new ArrayList<>(); inputList.addAll(Arrays.asList(HBaseStorageConstants.INSERT_PUT_MODE)); client.unsetSessionVariables(inputList); if (scanner != null) { scanner.close(); } if (htable != null) { htable.close(); } } }

Target:
public void testInsertIntoUsingPut() throws Exception { executeString( "CREATE TABLE hbase_mapped_table (rk text, col1 text, col2 text, col3 int4) TABLESPACE cluster1 " + "USING hbase WITH ('table'='hbase_table', 'columns'=':key,col1:a,col2:,col3:b#b')").close(); assertTableExists("hbase_mapped_table"); TableDesc tableDesc = catalog.getTableDesc(getCurrentDatabase(), "hbase_mapped_table"); Map<String, String> sessions = new HashMap<>(); sessions.put(HBaseStorageConstants.INSERT_PUT_MODE, "true"); client.updateSessionVariables(sessions); HTable htable = null; ResultScanner scanner = null; try { executeString( "insert into hbase_mapped_table " + "select l_orderkey::text, l_shipdate, l_returnflag, l_suppkey from default.lineitem" ).close(); htable = new HTable(testingCluster.getHBaseUtil().getConf(), "hbase_table"); Scan scan = new Scan(); scan.addFamily(Bytes.toBytes("col1")); scan.addFamily(Bytes.toBytes("col2")); scan.addFamily(Bytes.toBytes("col3")); scanner = htable.getScanner(scan); assertStrings(resultSetToString(scanner, new byte[][]{null, Bytes.toBytes("col1"), Bytes.toBytes("col2"), Bytes.toBytes("col3")}, new byte[][]{null, Bytes.toBytes("a"), null, Bytes.toBytes("b")}, new boolean[]{false, false, false, true}, tableDesc.getSchema())); } finally { executeString("DROP TABLE hbase_mapped_table PURGE").close(); client.unsetSessionVariables(Arrays.asList(HBaseStorageConstants.INSERT_PUT_MODE)); if (scanner != null) { scanner.close(); } if (htable != null) { htable.close(); } } }
Source:
public GremlinServer(final Settings settings) { this.settings = settings; this.isLinuxOS = settings.useEpollEventLoop && SystemUtils.IS_OS_LINUX; Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown")); final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d"); if(isLinuxOS){ bossGroup = new EpollEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } else { bossGroup = new NioEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } final ThreadFactory threadFactoryWorker = ThreadFactoryUtil.create("worker-%d"); if(isLinuxOS) { workerGroup = new EpollEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); }else { workerGroup = new NioEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); } serverGremlinExecutor = new ServerGremlinExecutor<>(settings, null, workerGroup, EventLoopGroup.class); gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService(); }

Target:
public GremlinServer(final Settings settings) { this.settings = settings; this.isEpollEnabled = settings.useEpollEventLoop && SystemUtils.IS_OS_LINUX; if(settings.useEpollEventLoop && !SystemUtils.IS_OS_LINUX){ logger.warn("cannot use epoll in non-linux env, falling back to NIO"); } Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown")); final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d"); if(isEpollEnabled){ bossGroup = new EpollEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } else { bossGroup = new NioEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } final ThreadFactory threadFactoryWorker = ThreadFactoryUtil.create("worker-%d"); if(isEpollEnabled) { workerGroup = new EpollEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); }else { workerGroup = new NioEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); } serverGremlinExecutor = new ServerGremlinExecutor<>(settings, null, workerGroup, EventLoopGroup.class); gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService(); }
Source:
void showTooltip (int x, int y) { checkWidget (); if (itemToolTip == null) return; itemToolTip.setLocation (x, y); itemToolTip.setVisible (true); }

Target:
void showTooltip (int x, int y) { if (itemToolTip == null) return; itemToolTip.setLocation (x, y); itemToolTip.setVisible (true); }
Source:
public boolean submitOrderToServer(String orderInfo) { boolean result = true; String submitUrl = getRequestUrl(null, SUBMIT_PAGE); Bundle params = new Bundle(); params.putString("orders", orderInfo); String resultStr = reqHelper.doPost(submitUrl, params); if (resultStr == null || !resultStr.equals(STATUS_SUCCESS)) { result = false; } return result; }

Target:
public static boolean submitOrderToServer(String orderInfo) { boolean result = true; String submitUrl = getRequestUrl(null, SUBMIT_PAGE); Bundle params = new Bundle(); params.putString("orders", orderInfo); String resultStr = RequestHelper.doRequestPost(submitUrl, params); if (resultStr == null || !resultStr.equals(STATUS_SUCCESS)) { result = false; } return result; }
Source:
public boolean matches(ConditionContext context, @NonNull AnnotatedTypeMetadata metadata) { final String value = context.getEnvironment(). getProperty("ot.server.low-resource-monitor.enabled", "true"); return "true".equals(value); }

Target:
public boolean matches(ConditionContext context, @NonNull AnnotatedTypeMetadata metadata) { final String value = context.getEnvironment(). getProperty("ot.server.low-resource-monitor.enabled", "false"); return Boolean.parseBoolean(value); }
Source:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); String snapshotName = getParameters().getSnapshotName(); String description = getParameters().getDescription() == null ? "" : getParameters().getDescription(); boolean force = getParameters().getForce() ? true : false; uuidReturn = getBroker().glusterSnapshotCreate(volumeName, snapshotName, description, force); proceedProxyReturnValue(); if (getVDSReturnValue().getSucceeded()) { setReturnValue(Guid.createGuidFromStringDefaultEmpty(uuidReturn.mUuid)); } }

Target:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); String snapshotName = getParameters().getSnapshotName(); String description = getParameters().getDescription() == null ? "" : getParameters().getDescription(); boolean force = getParameters().getForce(); uuidReturn = getBroker().glusterSnapshotCreate(volumeName, snapshotName, description, force); proceedProxyReturnValue(); if (getVDSReturnValue().getSucceeded()) { setReturnValue(Guid.createGuidFromStringDefaultEmpty(uuidReturn.mUuid)); } }
Source:
public void testUrlWithNonExistSchema() throws Exception { String url = "jdbc:splice://localhost:1527/splicedb;create=true;user=%s;password=%s;schema=" + "nonexist"; try (Connection connection = SpliceNetConnection.getConnectionAs(url, SpliceNetConnection.DEFAULT_USER, SpliceNetConnection.DEFAULT_USER_PASSWORD)) { Assert.fail("Connect to non exist schema should fail"); } catch (SQLException e) { Assert.assertEquals("Upexpected failure: "+ e.getMessage(), e.getSQLState(), SQLState.LANG_SCHEMA_DOES_NOT_EXIST); } }

Target:
public void testUrlWithNonExistSchema() throws Exception { String url = "jdbc:splice://localhost:1527/splicedb;user=%s;password=%s;schema=nonexist"; try (Connection connection = SpliceNetConnection.getConnectionAs(url, SpliceNetConnection.DEFAULT_USER, SpliceNetConnection.DEFAULT_USER_PASSWORD)) { Assert.fail("Connect to non exist schema should fail"); } catch (SQLException e) { Assert.assertEquals("Upexpected failure: "+ e.getMessage(), e.getSQLState(), SQLState.LANG_SCHEMA_DOES_NOT_EXIST); } }
Source:
public void update() { FBO readOnlyGBufferFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); FBO refractiveReflectiveFbo = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); readOnlyGBufferFbo.attachDepthBufferTo(refractiveReflectiveFbo); }

Target:
public void update() { readOnlyGBufferFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); refractiveReflectiveFbo = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); readOnlyGBufferFbo.attachDepthBufferTo(refractiveReflectiveFbo); }
Source:
void updateInfo() { DirectionsGenerator gen = new DirectionsGenerator(itinerary.legs, getActivity().getApplicationContext()); List<Direction> directions = gen.getDirections(); Direction direction_data[] = directions.toArray(new Direction[directions.size()]); DirectionExpandableListAdapter adapter = new DirectionExpandableListAdapter( getActivity(), R.layout.list_direction_item, R.layout.list_subdirection_item, direction_data); mDirectionsListView.setAdapter(adapter); mDirectionsListView.setGroupIndicator(null); mRealtimeService.onItinerarySelected(itinerary, rank); }

Target:
void updateInfo() { DirectionsGenerator gen = new DirectionsGenerator(itinerary.legs, getActivity().getApplicationContext()); List<Direction> directions = gen.getDirections(); Direction direction_data[] = directions.toArray(new Direction[directions.size()]); DirectionExpandableListAdapter adapter = new DirectionExpandableListAdapter( getActivity(), R.layout.list_direction_item, R.layout.list_subdirection_item, direction_data); mDirectionsListView.setAdapter(adapter); mDirectionsListView.setGroupIndicator(null); if(Application.getPrefs() .getBoolean(getString(R.string.preference_key_trip_plan_notifications), true)) { mRealtimeService.onItinerarySelected(itinerary); } }
Source:
private FileList listFiles(PluginTask task) { LOGGER.info("Start listing file with prefix [{}]", task.getPathPrefix()); try { AmazonS3 client = newS3Client(task); String bucketName = task.getBucket(); if (task.getPathPrefix().equals("/")) { LOGGER.info("Listing files with prefix \"/\". This doesn't mean all files in a bucket. If you intend to read all files, use \"path_prefix: ''\" (empty string) instead."); } FileList.Builder builder = new FileList.Builder(task); listS3FilesByPrefix(builder, client, bucketName, task.getPathPrefix(), task.getLastPath(), task.getSkipGlacierObjects()); LOGGER.info("Found total files", builder.size()); return builder.build(); } catch (AmazonServiceException ex) { if (ex.getErrorType().equals(AmazonServiceException.ErrorType.Client)) { if (ex.getStatusCode() != 400 || "ExpiredToken".equalsIgnoreCase(ex.getErrorCode())) { throw new ConfigException(ex); } } throw ex; } catch (InterruptedException | RetryGiveupException ex) { throw new AmazonServiceException(ex.getMessage()); } }

Target:
private FileList listFiles(PluginTask task) { LOGGER.info("Start listing file with prefix [{}]", task.getPathPrefix()); try { AmazonS3 client = newS3Client(task); String bucketName = task.getBucket(); if (task.getPathPrefix().equals("/")) { LOGGER.info("Listing files with prefix \"/\". This doesn't mean all files in a bucket. If you intend to read all files, use \"path_prefix: ''\" (empty string) instead."); } FileList.Builder builder = new FileList.Builder(task); listS3FilesByPrefix(builder, client, bucketName, task.getPathPrefix(), task.getLastPath(), task.getSkipGlacierObjects()); LOGGER.info("Found total files", builder.size()); return builder.build(); } catch (AmazonServiceException ex) { if (ex.getErrorType().equals(AmazonServiceException.ErrorType.Client)) { if (ex.getStatusCode() != 400 || "ExpiredToken".equalsIgnoreCase(ex.getErrorCode())) { throw new ConfigException(ex); } } throw ex; } catch (InterruptedException | RetryGiveupException ex) { throw new RuntimeException(ex); } }
Source:
private Long getDeviceId(UserVmVO vm, Long deviceId) { int maxDataVolumesSupported = getMaxDataVolumesSupported(vm); List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); if (deviceId != null) { if (deviceId.longValue() > maxDataVolumesSupported || deviceId.longValue() == 3) { throw new RuntimeException("deviceId should be 1,2,4-" + maxDataVolumesSupported); } for (VolumeVO vol : vols) { if (vol.getDeviceId().equals(deviceId)) { throw new RuntimeException("deviceId " + deviceId + " is used by vm" + vm.getId()); } } } else { List<String> devIds = new ArrayList<String>(); for (int i = 1; i < maxDataVolumesSupported; i++) { devIds.add(String.valueOf(i)); } devIds.remove("3"); for (VolumeVO vol : vols) { devIds.remove(vol.getDeviceId().toString().trim()); } deviceId = Long.parseLong(devIds.iterator().next()); } return deviceId; }

Target:
private Long getDeviceId(UserVmVO vm, Long deviceId) { int maxDeviceId = getMaxDataVolumesSupported(vm) - 1; List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); if (deviceId != null) { if (deviceId.longValue() <= 0 || deviceId.longValue() > maxDeviceId || deviceId.longValue() == 3) { throw new RuntimeException("deviceId should be 1,2,4-" + maxDeviceId); } for (VolumeVO vol : vols) { if (vol.getDeviceId().equals(deviceId)) { throw new RuntimeException("deviceId " + deviceId + " is used by vm " + vm.getId()); } } } else { List<String> devIds = new ArrayList<String>(); for (int i = 1; i <= maxDeviceId; i++) { devIds.add(String.valueOf(i)); } devIds.remove("3"); for (VolumeVO vol : vols) { devIds.remove(vol.getDeviceId().toString().trim()); } if (devIds.isEmpty()) { throw new RuntimeException("All device Ids are used by vm " + vm.getId()); } deviceId = Long.parseLong(devIds.iterator().next()); } return deviceId; }
Source:
public void createPartControl(Composite aParent) { super.createPartControl(aParent); }

Target:
public void createPartControl(Composite aParent) { super.createPartControl(aParent); getCommonViewer().setMapper(new ResourceToItemsMapper(getCommonViewer())); }
Source:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(1) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); Map<String, String> jobNameById = getConfiguration().jobNameById; HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<HudsonModelJob>(); List<Object> jobsNodes = hudson.getJob(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonModelJob.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); job.setUrl(jobUrl); if (jobUrl != null && hudsonUrlUtil.isNestedJob(jobUrl)) { jobNameById.put(job.getUrl(), job.getUrl()); } else { jobNameById.put(job.getName(), job.getUrl()); } buildPlans.add(job); } else { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } if (ids == null) { HudsonConfiguration configuration = new HudsonConfiguration(); configuration.jobNameById = jobNameById; setConfiguration(configuration); } return buildPlans; } }.run(); }

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(1) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<HudsonModelJob>(); List<Object> jobsNodes = hudson.getJob(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonModelJob.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); job.setUrl(jobUrl); buildPlans.add(job); } else { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }
Source:
public boolean isCancelled() { return false; }

Target:
public boolean isCancelled() { return cancelled; }
Source:
public void queueEvent(Event event) { if (eventFilter.shouldFilter(event)) { log.debug("Filtering event {}", event); return; } modeManager.throwRestEasyExceptionIfInSuspendMode(); log.debug("Queuing event: {}", event); try { initializeMessageSending(); ClientMessage message = session.createMessage(true); String eventString = mapper.writeValueAsString(event); message.getBodyBuffer().writeString(eventString); producer.send(message); } catch (Exception e) { log.error("Error while trying to send event", e); } }

Target:
public void queueEvent(Event event) { if (eventFilter.shouldFilter(event)) { log.debug("Filtering event {}", event); return; } modeManager.throwRestEasyExceptionIfInSuspendMode(); log.debug("Queuing event: {}", event); try { if (messageSender == null) { messageSender = new EventMessageSender(this.connection); } messageSender.queueMessage(mapper.writeValueAsString(event)); } catch (Exception e) { log.error("Error while trying to send event", e); } }
Source:
private void setupPointTransform( AffineTransform tempTransform, Point centroid, TextStyle2D textStyle, LabelPainter painter) { tempTransform.translate(centroid.getX(), centroid.getY()); double rotation = textStyle.getRotation(); if (Double.isNaN(rotation) || Double.isInfinite(rotation)) { rotation = 0.0; } tempTransform.rotate(rotation); Rectangle2D textBounds = painter.getLabelBounds(); double displacementX = (textStyle.getAnchorX() * (-textBounds.getWidth())) + textStyle.getDisplacementX(); double displacementY = (textStyle.getAnchorY() * (textBounds.getHeight())) - textStyle.getDisplacementY() - textBounds.getHeight() + ((painter.lines.size() == 1) ? painter.getLineHeight() : painter.getLastLineHeight()); tempTransform.translate(displacementX, displacementY); }

Target:
private void setupPointTransform( AffineTransform tempTransform, Point centroid, TextStyle2D textStyle, LabelPainter painter) { tempTransform.translate(centroid.getX(), centroid.getY()); double rotation = textStyle.getRotation(); if (Double.isNaN(rotation) || Double.isInfinite(rotation)) { rotation = 0.0; } tempTransform.rotate(rotation); Rectangle2D textBounds = painter.getLabelBounds(); double displacementX = (textStyle.getAnchorX() * (-textBounds.getWidth())) + textStyle.getDisplacementX(); double displacementY = (textStyle.getAnchorY() * (textBounds.getHeight())) - textStyle.getDisplacementY() - textBounds.getHeight() + ((painter.lines.size() == 1) ? painter.getLineHeight() : painter.getLineHeightForAnchorY(textStyle.getAnchorY())); tempTransform.translate(displacementX, displacementY); }
Source:
private Map<String, String> parseConfig(String[] fertilizerList, ImmutableMap.Builder<ItemStack, Integer> fertilizerMap){ Map<String, String> configEntries = new HashMap<>(); for(String entry : fertilizerList){ String[] spited = entry.split(";"); if(spited.length < 2){ Log.error("Foretsry failed to parse a entry of the fertilizer config."); continue; } String itemName = spited[0]; ItemStack fertilizerItem = ItemStackUtil.parseItemStackString(itemName, OreDictionary.WILDCARD_VALUE); if(fertilizerItem == null || fertilizerItem.isEmpty()){ Log.error("Foretsry failed to parse a entry of the fertilizer config, because the item doesn't exists."); continue; } String value = spited[1]; int fertilizerValue = Integer.parseInt(value); if(fertilizerValue > 0) { fertilizerMap.put(fertilizerItem, fertilizerValue); } configEntries.put(itemName, value); } return configEntries; }

Target:
private Map<String, String> parseConfig(String[] fertilizerList, ImmutableMap.Builder<ItemStack, Integer> fertilizerMap){ Map<String, String> configEntries = new HashMap<>(); for(String entry : fertilizerList){ String[] spited = entry.split(";"); if(spited.length < 2){ Log.error("Forestry failed to parse a entry of the fertilizer config."); continue; } String itemName = spited[0]; ItemStack fertilizerItem = ItemStackUtil.parseItemStackString(itemName, OreDictionary.WILDCARD_VALUE); if(fertilizerItem == null || fertilizerItem.isEmpty()){ Log.error("Forestry failed to parse a entry of the fertilizer config, because the item doesn't exists."); continue; } String value = spited[1]; int fertilizerValue = Integer.parseInt(value); if(fertilizerValue > 0) { fertilizerMap.put(fertilizerItem, fertilizerValue); } configEntries.put(itemName, value); } return configEntries; }
Source:
public static String prettyPrintTime(long time, TimeUnit unit) { long nanos = unit.toNanos(time); if (nanos < 10000) return nanos + " ns"; long micros = unit.toMicros(time); if (micros < 10000) return micros + " us"; long millis = unit.toMillis(time); if (millis < 1000) return millis + " ms"; NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(2); double toPrint = ((double) millis) / 1000; if (toPrint < 300) { return nf.format(toPrint) + " seconds"; } toPrint = toPrint / 60; if (toPrint < 120) { return nf.format(toPrint) + " minutes"; } toPrint = toPrint / 60; return nf.format(toPrint) + " hours"; }

Target:
public static String prettyPrintTime(long time, TimeUnit unit) { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(2); if (unit.toNanos(time) < 1000) return nf.format(convert(time, unit, TimeUnit.NANOSECONDS)) + " ns"; if (unit.toMicros(time) < 1000) return nf.format(convert(time, unit, TimeUnit.MICROSECONDS)) + " us"; if (unit.toMillis(time) < 1000) return nf.format(convert(time, unit, TimeUnit.MILLISECONDS)) + " ms"; if (unit.toSeconds(time) < 300) return nf.format(convert(time, unit, TimeUnit.SECONDS)) + " seconds"; if (unit.toMinutes(time) < 120) return nf.format(convert(time, unit, TimeUnit.MINUTES)) + " minutes"; return nf.format(convert(time, unit, TimeUnit.HOURS)) + " hours"; }
Source:
private RequestController suspendedRCWithQueuedTasks(int i, Runnable whenExecuted) { RequestController _ret = new RequestController(false); _ret.suspended(() -> { }); for (int taskNo = 0; taskNo < TASKS_QTY; taskNo++) { _ret.queueTask(null, null, task -> whenExecuted.run(), 0, null, false, false); } return _ret; }

Target:
private RequestController suspendedRCWithQueuedTasks(int i, Runnable whenExecuted) { RequestController requestController = new RequestController(false); requestController.suspended(() -> { }); for (int taskNo = 0; taskNo < TASKS_QTY; taskNo++) { requestController.queueTask(null, null, task -> whenExecuted.run(), 0, null, false, false); } return requestController; }
Source:
private void setPointShapeProperty(String newValue) { int pointShape = Integer.parseInt(newValue); if (chartDataModel instanceof MockScatterChartDataModel) { ((MockScatterChartDataModel)chartDataModel).changePointShape(pointShape); } }

Target:
private void setPointShapeProperty(String newValue) { int pointShape = Integer.parseInt(newValue); if (chartDataModel instanceof MockPointChartDataModel) { ((MockPointChartDataModel) chartDataModel).changePointShape(pointShape); } }
Source:
public Producer<String, String> takeProducer() { rwLock.readLock().lock(); try { if (null != activeProducer) { useCount.get(activeProducer).incrementAndGet(); return activeProducer; } } finally { rwLock.readLock().unlock(); } rwLock.writeLock().lock(); try { if (null != activeProducer) { useCount.get(activeProducer).incrementAndGet(); return activeProducer; } activeProducer = new KafkaProducer<>(kafkaLocationManager.getKafkaProducerProperties()); useCount.put(activeProducer, new AtomicInteger(1)); return activeProducer; } finally { rwLock.writeLock().unlock(); } }

Target:
public Producer<String, String> takeProducer() { Producer<String, String> result = takeUnderLock(false); if (null == result) { result = takeUnderLock(true); } useCountMetric.inc(); return result; }
Source:
public LogisticRegSummary decode(final byte[] data) { final ByteArrayInputStream bais = new ByteArrayInputStream(data); final LinearModel model; final int count; final int posNum; final int negNum; try (final DataInputStream dais = new DataInputStream(bais)) { count = dais.readInt(); posNum = dais.readInt(); negNum = dais.readInt(); model = sparseLinearModelCodec.decodeFromStream(dais); } catch (final IOException e) { throw new RuntimeException(e.getCause()); } return new LogisticRegSummary(model, count, posNum, negNum); }

Target:
public LogisticRegSummary decode(final byte[] data) { try (final DataInputStream dais = new DataInputStream(new ByteArrayInputStream(data))) { final int count = dais.readInt(); final int posNum = dais.readInt(); final int negNum = dais.readInt(); final LinearModel model = sparseLinearModelCodec.decodeFromStream(dais); return new LogisticRegSummary(model, count, posNum, negNum); } catch (final IOException e) { throw new RuntimeException(e.getCause()); } }
Source:
public ParameterMetadataImpl( Map<Integer,OrdinalParameterDescriptor> ordinalDescriptorMap, Map<String, NamedParameterDescriptor> namedDescriptorMap) { this.ordinalDescriptorMap = ordinalDescriptorMap == null ? Collections.emptyMap() : Collections.unmodifiableMap( ordinalDescriptorMap ); this.ordinalDescriptorValueCache = ordinalDescriptorMap == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(this.ordinalDescriptorMap.values())); this.namedDescriptorMap = namedDescriptorMap == null ? Collections.emptyMap() : Collections.unmodifiableMap( namedDescriptorMap ); this.namedDescriptorValueCache = namedDescriptorMap == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(this.namedDescriptorMap.values())); if (ordinalDescriptorMap != null && ! ordinalDescriptorMap.isEmpty() ) { final List<Integer> sortedPositions = new ArrayList<>( ordinalDescriptorMap.keySet() ); sortedPositions.sort( ComparableComparator.INSTANCE ); int lastPosition = -1; for ( Integer sortedPosition : sortedPositions ) { if ( lastPosition == -1 ) { lastPosition = sortedPosition; continue; } if ( sortedPosition != lastPosition + 1 ) { throw new QueryException( String.format( Locale.ROOT, "Unexpected gap in ordinal parameter labels [%s -> %s] : [%s]", lastPosition, sortedPosition, StringHelper.join( ",", sortedPositions.iterator() ) ) ); } lastPosition = sortedPosition; } } }

Target:
public ParameterMetadataImpl( Map<Integer,OrdinalParameterDescriptor> ordinalDescriptorMap, Map<String, NamedParameterDescriptor> namedDescriptorMap) { this.ordinalDescriptorMap = ordinalDescriptorMap == null ? Collections.emptyMap() : Collections.unmodifiableMap( ordinalDescriptorMap ); this.ordinalDescriptorValueCache = this.ordinalDescriptorMap.isEmpty() ? Collections.emptySet() : Collections.unmodifiableCollection( this.ordinalDescriptorMap.values() ); this.namedDescriptorMap = namedDescriptorMap == null ? Collections.emptyMap() : Collections.unmodifiableMap( namedDescriptorMap ); this.namedDescriptorValueCache = this.namedDescriptorMap.isEmpty() ? Collections.emptySet() : Collections.unmodifiableCollection( this.namedDescriptorMap.values() ); if (ordinalDescriptorMap != null && ! ordinalDescriptorMap.isEmpty() ) { final List<Integer> sortedPositions = new ArrayList<>( ordinalDescriptorMap.keySet() ); sortedPositions.sort( ComparableComparator.INSTANCE ); int lastPosition = -1; for ( Integer sortedPosition : sortedPositions ) { if ( lastPosition == -1 ) { lastPosition = sortedPosition; continue; } if ( sortedPosition != lastPosition + 1 ) { throw new QueryException( String.format( Locale.ROOT, "Unexpected gap in ordinal parameter labels [%s -> %s] : [%s]", lastPosition, sortedPosition, StringHelper.join( ",", sortedPositions.iterator() ) ) ); } lastPosition = sortedPosition; } } }
Source:
protected static void openEditor(final IWorkbenchPage page, final EditorHandle handle, final IBuild build, final boolean partial) { Display.getDefault().syncExec(new Runnable() { public void run() { if (!page.getWorkbenchWindow().getShell().isDisposed()) { BuildEditorInput input = new BuildEditorInput(build, partial); try { IEditorPart part = page.openEditor(input, BuildsUiConstants.ID_EDITOR_BUILDS); handle.setPart(part); handle.setStatus(Status.OK_STATUS); } catch (PartInitException e) { IStatus status = new Status(IStatus.ERROR, BuildsUiPlugin.ID_PLUGIN, "Unexpected error while opening build", e); StatusHandler.log(status); handle.setStatus(status); } } } }); }

Target:
protected static void openEditor(final IWorkbenchPage page, final EditorHandle handle, final IBuild build, final boolean partial) { BuildEditorInput input = new BuildEditorInput(build, partial); try { IEditorPart part = page.openEditor(input, BuildsUiConstants.ID_EDITOR_BUILDS); handle.setPart(part); handle.setStatus(Status.OK_STATUS); } catch (PartInitException e) { IStatus status = new Status(IStatus.ERROR, BuildsUiPlugin.ID_PLUGIN, "Unexpected error while opening build", e); StatusHandler.log(status); handle.setStatus(status); } }
Source:
public void tearDown() { System.out.println("Stopping the worker.."); workerApplicationContext.close(); }

Target:
public void tearDown() throws Exception { this.workerApplicationContext.close(); this.brokerService.stop(); }
Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (targetChannel.isRequestWritten()) { if (msg instanceof HttpResponse) { targetRespMsg = setUpCarbonMessage(ctx, msg); if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) { HTTPTransportContextHolder.getInstance().getHandlerExecutor(). executeAtTargetResponseReceiving(targetRespMsg); } if (this.httpResponseFuture != null) { try { httpResponseFuture.notifyHttpListener(targetRespMsg); } catch (Exception e) { LOG.error("Error while notifying response to listener ", e); } } else { LOG.error("Cannot correlate callback with request callback is null"); } } else { if (targetRespMsg != null) { HttpContent httpContent = (HttpContent) msg; targetRespMsg.addHttpContent(httpContent); if (msg instanceof LastHttpContent) { if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) { HTTPTransportContextHolder.getInstance().getHandlerExecutor(). executeAtTargetResponseSending(targetRespMsg); } targetChannel.getChannel().pipeline().remove(Constants.IDLE_STATE_HANDLER); connectionManager.returnChannel(targetChannel); } } } } else { if (msg instanceof HttpResponse) { LOG.warn("Received a response for an obsolete request"); } ReferenceCountUtil.release(msg); } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (targetChannel.isRequestWritten()) { if (msg instanceof HttpResponse) { targetRespMsg = setUpCarbonMessage(ctx, msg); if (handlerExecutor != null) { handlerExecutor.executeAtTargetResponseReceiving(targetRespMsg); } if (this.httpResponseFuture != null) { try { httpResponseFuture.notifyHttpListener(targetRespMsg); } catch (Exception e) { LOG.error("Error while notifying response to listener ", e); } } else { LOG.error("Cannot correlate callback with request callback is null"); } } else { if (targetRespMsg != null) { HttpContent httpContent = (HttpContent) msg; targetRespMsg.addHttpContent(httpContent); if (Util.isLastHttpContent(httpContent)) { if (handlerExecutor != null) { handlerExecutor.executeAtTargetResponseSending(targetRespMsg); } targetChannel.getChannel().pipeline().remove(Constants.IDLE_STATE_HANDLER); connectionManager.returnChannel(targetChannel); } } } } else { if (msg instanceof HttpResponse) { LOG.warn("Received a response for an obsolete request"); } ReferenceCountUtil.release(msg); } }
Source:
public static <T> ReplaySubject<T> create(int capacity) { final ReplayState<T, Integer> state; if (capacity <= 0 || capacity > 1) { state = new UnboundedReplayState<T>(capacity); } else { state = new SingleValueReplayState<T>(capacity); } SubjectSubscriptionManager<T> ssm = new SubjectSubscriptionManager<T>(); ssm.onStart = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { int lastIndex = state.replayObserverFromIndex(0, o); o.index(lastIndex); } }; ssm.onTerminated = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { Integer idx = o.index(); if (idx == null) { idx = 0; } state.replayObserverFromIndex(idx, o); } }; return new ReplaySubject<T>(ssm, ssm, state); }

Target:
public static <T> ReplaySubject<T> create(int capacity) { final ReplayState<T, Integer> state; if (capacity <= 0 || capacity > 1) { state = new UnboundedReplayState<T>(capacity); } else { state = new SingleItemReplayState<T>(); } SubjectSubscriptionManager<T> ssm = new SubjectSubscriptionManager<T>(); ssm.onStart = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { int lastIndex = state.replayObserverFromIndex(0, o); o.index(lastIndex); } }; ssm.onTerminated = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { Integer idx = o.index(); if (idx == null) { idx = 0; } state.replayObserverFromIndex(idx, o); } }; return new ReplaySubject<T>(ssm, ssm, state); }
Source:
public static void setup() { data = new DummyPOJO(); laggards = new DummyLaggards(); try { laggards.clazz = Class.forName("com.datatorrent.lib.laggards.LaggardsTest$DummyPOJO"); } catch (ClassNotFoundException e) { logger.error("CLASS NOT FOUND: com.datatorrent.lib.laggards.LaggardsTest$DummyPOJO"); } }

Target:
public static void setup() { data = new DummyPOJO(); laggards = new DummyLaggards(); laggards.clazz = DummyPOJO.class; }
Source:
public ChannelGroup transform(org.atlasapi.media.entity.simple.ChannelGroup simple) { Platform complex = new Platform(); if (Strings.isNullOrEmpty(simple.getId())) { complex.setId(idCodec.decode(simple.getId()).longValue()); } complex.setPublisher(getPublisher(simple.getPublisherDetails())); complex.addTitle(simple.getTitle()); complex.setAvailableCountries(Countries.fromCodes(simple.getAvailableCountries())); return complex; }

Target:
public ChannelGroup transform(org.atlasapi.media.entity.simple.ChannelGroup simple) { Platform complex = new Platform(); if (!Strings.isNullOrEmpty(simple.getId())) { complex.setId(idCodec.decode(simple.getId()).longValue()); } complex.setPublisher(extractPublisher(simple.getPublisherDetails())); complex.addTitle(simple.getTitle()); complex.setAvailableCountries(Countries.fromCodes(simple.getAvailableCountries())); return complex; }
Source:
private String makeUrl(ContainerPort port, String protocol, String path, String hostname) { if (protocol == null) { if (port.getType() == null) { protocol = "tcp"; } else { protocol = port.getType(); } } if (path == null) { path = ""; } else if (!path.startsWith("/")) { path = '/' + path; } int serverPort = port.getPublicPort() != 0 ? port.getPublicPort() : port.getPrivatePort(); return protocol + "://" + hostname + ':' + serverPort + path; }

Target:
private String makeUrl(ContainerPort port, String protocol, String path, String hostname) throws InternalInfrastructureException { if (protocol == null) { if (port.getType() == null) { protocol = "tcp"; } else { protocol = port.getType(); } } if (path == null) { path = ""; } else if (!path.startsWith("/")) { path = '/' + path; } int serverPort = port.getPublicPort() != 0 ? port.getPublicPort() : port.getPrivatePort(); try { return new URI(protocol, null, hostname, serverPort, path, null, null).toString(); } catch (URISyntaxException e) { throw new InternalInfrastructureException( "Constructing of URI of server failed. Error: " + e.getLocalizedMessage()); } }
Source:
public String create(Request request, Response response) { final BasicEnvironmentConfig environmentConfigToCreate = (BasicEnvironmentConfig) buildEntityFromRequestBody(request); final HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); if (!environmentConfigToCreate.getAllErrors().isEmpty()) { operationResult.unprocessableEntity("Error parsing environment config from the request"); return handleCreateOrUpdateResponse(request, response, environmentConfigToCreate, operationResult); } haltIfEntityWithSameNameExists(environmentConfigToCreate); environmentConfigService.createEnvironment(environmentConfigToCreate, currentUsername(), operationResult); setEtagHeader(environmentConfigToCreate, response); return handleCreateOrUpdateResponse(request, response, environmentConfigToCreate, operationResult); }

Target:
public String create(Request request, Response response) { final BasicEnvironmentConfig environmentConfigToCreate = (BasicEnvironmentConfig) buildEntityFromRequestBody(request); final HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); haltIfEntityWithSameNameExists(environmentConfigToCreate); if (!environmentConfigToCreate.getAllErrors().isEmpty()) { operationResult.unprocessableEntity("Error parsing environment config from the request"); return handleCreateOrUpdateResponse(request, response, environmentConfigToCreate, operationResult); } environmentConfigService.createEnvironment(environmentConfigToCreate, currentUsername(), operationResult); setEtagHeader(environmentConfigToCreate, response); return handleCreateOrUpdateResponse(request, response, environmentConfigToCreate, operationResult); }
Source:
public void run() { try { while (run || !queue.isEmpty()) { Event event = queue.poll(100, TimeUnit.MILLISECONDS); if (event == null) { continue; } List<Event> events = new ArrayList<>(bufferSize); events.add(event); queue.drainTo(events, bufferSize - 1); this.sender.push(events); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }

Target:
public void run() { try { while (run || !queue.isEmpty()) { Event event = queue.poll(100, MILLISECONDS); if (event == null) { continue; } List<Event> events = new ArrayList<>(bufferSize); events.add(event); queue.drainTo(events, bufferSize - 1); this.sender.push(events); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
Source:
protected void assertTenantOrParentTenant(TenantAware tenantAware) { if (tenantAware == null) { return; } if (!tenantAware.getTenant().is(currentTenant()) && !tenantAware.getTenant() .is(currentTenant().getParent().getValue())) { throw Exceptions.createHandled().withNLSKey("BizController.invalidTenant").handle(); } }

Target:
protected void assertTenantOrParentTenant(TenantAware tenantAware) { if (tenantAware == null) { return; } if (!tenantAware.getTenant().is(currentTenant()) && tenantAware.getTenant().getId() != currentTenant().getParent().getId()) { throw Exceptions.createHandled().withNLSKey("BizController.invalidTenant").handle(); } }
Source:
private void initStore() { ColumnChunkPageWriteStore columnChunkPageWriteStore = new ColumnChunkPageWriteStore(compressor, schema, props.getAllocator(), props.getColumnIndexTruncateLength()); pageStore = columnChunkPageWriteStore; bloomFilterWriteStore = columnChunkPageWriteStore; columnStore = props.newColumnWriteStore(schema, pageStore, bloomFilterWriteStore); MessageColumnIO columnIO = new ColumnIOFactory(validating).getColumnIO(schema); this.recordConsumer = columnIO.getRecordWriter(columnStore); writeSupport.prepareForWrite(recordConsumer); }

Target:
private void initStore() { ColumnChunkPageWriteStore columnChunkPageWriteStore = new ColumnChunkPageWriteStore(compressor, schema, props.getAllocator(), props.getColumnIndexTruncateLength(), props.getPageWriteChecksumEnabled()); pageStore = columnChunkPageWriteStore; bloomFilterWriteStore = columnChunkPageWriteStore; columnStore = props.newColumnWriteStore(schema, pageStore, bloomFilterWriteStore); MessageColumnIO columnIO = new ColumnIOFactory(validating).getColumnIO(schema); this.recordConsumer = columnIO.getRecordWriter(columnStore); writeSupport.prepareForWrite(recordConsumer); }
Source:
public static Set<DistributionModuleGroup> getModuleGroups() { Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(new DistributionModuleGroup(CDH5120Constant.HDFS_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_PARQUET_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_PARQUET_MRREQUIRED_MODULE_GROUP.getModuleName(), true, null)); ComponentCondition conditionUseNavigator = new SimpleComponentCondition(new BasicExpression( MRConstant.USE_CLOUDERA_NAVIGATOR)); hs.add(new DistributionModuleGroup(CDH5120Constant.TALEND_CLOUDERA_CDH_5_12_NAVIGATOR.getModuleName(), true, conditionUseNavigator)); return hs; }

Target:
public static Set<DistributionModuleGroup> getModuleGroups() { Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(new DistributionModuleGroup(CDH5120Constant.HDFS_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_PARQUET_MODULE_GROUP.getModuleName())); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_PARQUET_MRREQUIRED_MODULE_GROUP.getModuleName(), true, null)); END_CLOUDERA_CDH_5_12_NAVIGATOR.getModuleName(), return hs; }
Source:
public String getRegionName() { List<String> rg = getRegionNames(); if (rg.size() == 0) { rg.add(file.getName()); } String ls = rg.get(0); if (ls.lastIndexOf('_') != -1) { if (!ls.endsWith(".obf") || !ls.matches(".*\\d+.*")) { return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' '); } else if (ls.matches("[a-zA-Z_-]+([0-9]+_*){3}[.a-z]+")){ String res = ls.substring(0, (ls.length() - 13)); return res.substring(0, res.lastIndexOf('_')).replace('_', ' '); } } return ls; }

Target:
public String getRegionName() { List<String> rg = getRegionNames(); if (rg.size() == 0) { rg.add(file.getName()); } String ls = rg.get(0); if (ls.lastIndexOf('_') != -1) { if (ls.matches(".*([0-9]+_*){3}\\.obf")) { Pattern osmDiffDateEnding = Pattern.compile("_([0-9]+_*){3}\\.obf"); Matcher m = osmDiffDateEnding.matcher(ls); if (m.find()) { ls = ls.substring(0, m.start()); } return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' '); } else { if (ls.contains(".")) { ls = ls.substring(0, ls.indexOf(".")); } if (ls.endsWith("_2")) { ls = ls.substring(0, ls.length() - "_2".length()); } return ls.substring(0, ls.lastIndexOf('_')).replace('_', ' '); } } return ls; }
Source:
protected Position handlePosition(Position position) { Collection<Attribute> attributes = Context.getAttributesManager().getItems( Context.getAttributesManager().getAllDeviceItems(position.getDeviceId())); for (Attribute attribute : attributes) { if (attribute.getAttribute() != null) { Object result = null; try { result = computeAttribute(attribute, position); } catch (JexlException error) { Log.warning(error); } if (result != null) { try { switch (attribute.getType()) { case "number": if (attribute.getAttribute().equals(false)) { position.getAttributes().remove(attribute.getAttribute()); } else { position.getAttributes().put(attribute.getAttribute(), (Number) result); } break; case "boolean": position.getAttributes().put(attribute.getAttribute(), (Boolean) result); break; default: if (attribute.getAttribute().equals(false)) { position.getAttributes().remove(attribute.getAttribute()); } else { position.getAttributes().put(attribute.getAttribute(), result.toString()); } } } catch (ClassCastException error) { Log.warning(error); } } else { position.getAttributes().remove(attribute.getAttribute()); } } } return position; }

Target:
protected Position handlePosition(Position position) { Collection<Attribute> attributes = Context.getAttributesManager().getItems( Context.getAttributesManager().getAllDeviceItems(position.getDeviceId())); for (Attribute attribute : attributes) { if (attribute.getAttribute() != null) { Object result = null; try { result = computeAttribute(attribute, position); } catch (JexlException error) { Log.warning(error); return position; } if (result != null) { try { switch (attribute.getType()) { case "number": if (attribute.getAttribute().equals(false) || attribute.getAttribute().equals(true)) { throw new IllegalArgumentException( "Number Attribute Type was returned Boolean instead of Number"); } else { position.getAttributes().put(attribute.getAttribute(), (Number) result); } break; case "boolean": position.getAttributes().put(attribute.getAttribute(), (Boolean) result); break; default: if (attribute.getAttribute().equals(false) || attribute.getAttribute().equals(true)) { throw new IllegalArgumentException( "Default Attribute Type was returned Boolean instead of String"); } else { position.getAttributes().put(attribute.getAttribute(), result.toString()); } } } catch (ClassCastException | IllegalArgumentException error) { Log.warning(error); } } else { position.getAttributes().remove(attribute.getAttribute()); } } } return position; }
Source:
public void setEnvironmentalVariables(final Map<String, String> envVbles) { configure(); String envVblesAsString = ""; if (envVbles != null) { for (Map.Entry<String, String> envVble : envVbles.entrySet()) { envVblesAsString += String.format("%s=%s\n", envVble.getKey(), envVble.getValue()); } } this.properties.set(envVblesAsString); save(); }

Target:
public void setEnvironmentalVariables(final Map<String, String> envVbles) { String envVblesAsString = ""; if (envVbles != null) { for (Map.Entry<String, String> envVble : envVbles.entrySet()) { envVblesAsString += String.format("%s=%s\n", envVble.getKey(), envVble.getValue()); } } this.properties.set(envVblesAsString); }
Source:
public COL get() { if (parsed==null) { synchronized (this) { if (parsed==null) { try { load(); } catch (IOException e) { throw new RuntimeException(e); } } } } return parsed; }

Target:
public COL get() { if (parsed==null) { synchronized (this) { if (parsed==null) { load(); } } } return parsed; }