auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private ILaunchConfiguration createLaunchConfiguration(GradleRunConfigurationAttributes configurationAttributes) { String taskNamesOrDefault = configurationAttributes.getTasks().isEmpty() ? "(default tasks)" : CollectionsUtils.joinWithSpace(configurationAttributes.getTasks()); String rawLaunchConfigurationName = String.format("%s - %s", configurationAttributes.getWorkingDir().getName(), taskNamesOrDefault); String launchConfigurationName = this.launchManager.generateLaunchConfigurationName(rawLaunchConfigurationName.replace(':', '.')); ILaunchConfigurationType launchConfigurationType = this.launchManager.getLaunchConfigurationType(GradleRunConfigurationDelegate.ID); try { ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, launchConfigurationName); configurationAttributes.apply(launchConfiguration); try { return launchConfiguration.doSave(); } catch (CoreException ex) { CorePlugin.logger().warn("Could not persisting Gradle launch configuration file", ex); return launchConfiguration; } } catch (CoreException e) { throw new GradlePluginsRuntimeException(String.format("Cannot create Gradle launch configuration %s.", launchConfigurationName), e); } }

Target:
private ILaunchConfiguration createLaunchConfiguration(GradleRunConfigurationAttributes configurationAttributes) { String taskNamesOrDefault = configurationAttributes.getTasks().isEmpty() ? "(default tasks)" : CollectionsUtils.joinWithSpace(configurationAttributes.getTasks()); String rawLaunchConfigurationName = String.format("%s - %s", configurationAttributes.getWorkingDir().getName(), taskNamesOrDefault); String launchConfigurationName = this.launchManager.generateLaunchConfigurationName(rawLaunchConfigurationName.replace(':', '.')); ILaunchConfigurationType launchConfigurationType = this.launchManager.getLaunchConfigurationType(GradleRunConfigurationDelegate.ID); try { ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, launchConfigurationName); configurationAttributes.apply(launchConfiguration); return persistConfiguration(launchConfiguration); } catch (CoreException e) { throw new GradlePluginsRuntimeException(String.format("Cannot create Gradle launch configuration %s.", launchConfigurationName), e); } }
Source:
private void clearSystemProperties() { System.setProperty("zookeeper.clientCnxnSocket", ""); System.setProperty("zookeeper.serverCnxnFactory", ""); System.setProperty("zookeeper.client.secure", ""); System.setProperty("zookeeper.ssl.keyStore.location", ""); System.setProperty("zookeeper.ssl.keyStore.password", ""); System.setProperty("zookeeper.ssl.trustStore.location", ""); System.setProperty("zookeeper.ssl.trustStore.password", ""); System.setProperty("zookeeper.ssl.hostnameVerification", ""); }

Target:
private void clearSystemProperties() { System.clearProperty(ZOOKEEPER_CLIENT_CNXN_SOCKET); System.clearProperty(ZOOKEEPER_SERVER_CNXN_FACTORY); System.clearProperty(SECURE_CLIENT); System.clearProperty(ZOOKEEPER_SSL_KEYSTORE_LOCATION); System.clearProperty(ZOOKEEPER_SSL_TRUSTSTORE_LOCATION); System.clearProperty(ZOOKEEPER_SSL_KEYSTORE_PASSWORD); System.clearProperty(ZOOKEEPER_SSL_TRUSTSTORE_PASSWORD); System.clearProperty(ZOOKEEPER_SSL_HOSTNAME_VERIFICATION); }
Source:
public void testOnDateChanged() { final Consumer<Moment> consumer = mock(Consumer.class); picker.setOnDateChanged(consumer); final String expected = "14:55:01"; final Moment moment = mock(Moment.class); when(moment.format("HH:mm:ss")).thenReturn(expected); picker.onDateChanged(moment); assertEquals(expected, input.value); verify(consumer).accept(momentArgumentCaptor.capture()); }

Target:
public void testOnDateChanged() { final Consumer<Moment> consumer = mock(Consumer.class); picker.setOnDateChanged(consumer); final String expected = "14:55:01"; final Moment moment = mock(Moment.class); when(moment.format("HH:mm:ss")).thenReturn(expected); picker.onDateChanged(moment); assertEquals(expected, input.value); verify(consumer).accept(argThat(new ArgumentMatcher<Moment>() { @Override public boolean matches(Object argument) { return Objects.equals(argument, moment); } })); }
Source:
public static boolean isServerStartedUp(AutomationContext automationContext, int portOffset) throws Exception { ClientConnectionUtil.waitForPort( Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset, DEFAULT_START_STOP_WAIT_MS, false, automationContext.getInstance().getHosts().get("default")); ClientConnectionUtil.waitForLogin(automationContext); log.info("Server started successfully."); return true; }

Target:
public static boolean isServerStartedUp(AutomationContext automationContext, int portOffset) throws CarbonToolsIntegrationTestException { try { ClientConnectionUtil.waitForPort( Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset, DEFAULT_START_STOP_WAIT_MS, false, automationContext.getInstance().getHosts().get("default")); ClientConnectionUtil.waitForLogin(automationContext); log.info("Server started successfully."); return true; } catch (Exception e) { log.error("Error while waiting for login ", e); throw new CarbonToolsIntegrationTestException("Error while waiting for login ", e); } }
Source:
public void testRegionReplicaSplitRegionAssignment() throws Exception { TableName tn = TableName.valueOf(this.name.getMethodName()); Table table = null; try { table = createTableAndLoadData(tn); HTU.loadNumericRows(table, f, 0, 3); List<RegionInfo> regions = new ArrayList<RegionInfo>(); for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { regions.add(r.getRegionInfo()); } } HTU.getAdmin().split(table.getName(), Bytes.toBytes("d")); int count = 0; while (true) { for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { count++; } } if (count >= 9) { break; } count = 0; } RegionReplicaTestHelper.assertReplicaDistributed(HTU, table); } finally { if (table != null) { HTU.deleteTable(tn); } } }

Target:
public void testRegionReplicaSplitRegionAssignment() throws Exception { TableName tn = TableName.valueOf(this.name.getMethodName()); Table table = null; try { table = createTableAndLoadData(tn); HTU.loadNumericRows(table, f, 0, 3); List<RegionInfo> regions = new ArrayList<RegionInfo>(); for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { regions.add(r.getRegionInfo()); } } HTU.getAdmin().split(table.getName(), Bytes.toBytes("d")); int count = 0; while (true) { for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { if (RegionReplicaUtil.isDefaultReplica(r.getRegionInfo())) { assertTrue(r.getStore(f).hasReferences() || r.getStore(f).getStorefiles().size() > 0); } count++; } } if (count >= 9) { break; } count = 0; } RegionReplicaTestHelper.assertReplicaDistributed(HTU, table); } finally { if (table != null) { HTU.deleteTable(tn); } } }
Source:
public File uploadFile(MultipartFile file) throws Exception { InputStream is = null; byte[] fileByteArray = null; File fileToPersist = getEntityClass().newInstance(); try { is = file.getInputStream(); fileByteArray = IOUtils.toByteArray(is); } catch(Exception e) { throw new Exception("Could not create the bytearray: " + e.getMessage()); } finally { IOUtils.closeQuietly(is); } fileToPersist.setFile(fileByteArray); fileToPersist.setFileType(file.getContentType()); fileToPersist.setFileName(file.getOriginalFilename()); dao.saveOrUpdate((E) fileToPersist); return fileToPersist; }

Target:
public E uploadFile(MultipartFile file) throws Exception { InputStream is = null; byte[] fileByteArray = null; E fileToPersist = getEntityClass().newInstance(); try { is = file.getInputStream(); fileByteArray = IOUtils.toByteArray(is); } catch(Exception e) { throw new Exception("Could not create the bytearray: " + e.getMessage()); } finally { IOUtils.closeQuietly(is); } fileToPersist.setFile(fileByteArray); fileToPersist.setFileType(file.getContentType()); fileToPersist.setFileName(file.getOriginalFilename()); dao.saveOrUpdate((E) fileToPersist); return fileToPersist; }
Source:
public void setup() { openTSDBMessageFormatter = Mockito.mock(OpenTSDBMessageFormatter.class); writer = new OpenTSDBWriter2(openTSDBMessageFormatter); outputWriter = Mockito.mock(Writer.class); result = Mockito.mock(Result.class); }

Target:
public void setup() { openTSDBMessageFormatter = mock(OpenTSDBMessageFormatter.class); writer = new OpenTSDBWriter2(openTSDBMessageFormatter); outputWriter = mock(Writer.class); result = mock(Result.class); }
Source:
public static void validateTwoSegments(File dir1, File dir2) throws IOException { final QueryableIndexIndexableAdapter adapter1 = new QueryableIndexIndexableAdapter(loadIndex(dir1)); final QueryableIndexIndexableAdapter adapter2 = new QueryableIndexIndexableAdapter(loadIndex(dir2)); if (adapter1.getNumRows() != adapter2.getNumRows()) { throw new SegmentValidationException("Row count mismatch"); } { final Set<String> dimNames1 = Sets.newHashSet(adapter1.getDimensionNames()); final Set<String> dimNames2 = Sets.newHashSet(adapter2.getDimensionNames()); if (!dimNames1.equals(dimNames2)) { throw new SegmentValidationException("Dimension names differ %s vs %s", dimNames1, dimNames2); } final Set<String> metNames1 = Sets.newHashSet(adapter1.getMetricNames()); final Set<String> metNames2 = Sets.newHashSet(adapter2.getMetricNames()); if (!metNames1.equals(metNames2)) { throw new SegmentValidationException("Metric names differ %s vs %s", metNames1, metNames2); } } final Iterator<Rowboat> it1 = adapter1.getRows().iterator(); final Iterator<Rowboat> it2 = adapter2.getRows().iterator(); long row = 0L; while (it1.hasNext()) { if (it1.hasNext() ^ it2.hasNext()) { throw new SegmentValidationException("Iterator doesn't have enough"); } final Rowboat rb1 = it1.next(); final Rowboat rb2 = it2.next(); ++row; if (rb1.getRowNum() != rb2.getRowNum()) { throw new SegmentValidationException("Row number mismatch: [%d] vs [%d]", rb1.getRowNum(), rb2.getRowNum()); } if (rb1.compareTo(rb2) != 0) { try { validateRowValues(rb1, adapter1, rb2, adapter2); } catch (SegmentValidationException ex) { throw new SegmentValidationException(ex, "Validation failure on row %d: [%s] vs [%s]", row, rb1, rb2); } } } if (it2.hasNext()) { throw new SegmentValidationException("Iterator still has more"); } if (row != adapter1.getNumRows()) { throw new SegmentValidationException("Actual Row count mismatch"); } }

Target:
public static void validateTwoSegments(File dir1, File dir2) throws IOException { validateTwoSegments( new QueryableIndexIndexableAdapter(loadIndex(dir1)), new QueryableIndexIndexableAdapter(loadIndex(dir2)) ); }
Source:
protected final void checkOracleConfig() { Preconditions.checkState(tablePrefix() != null, "Oracle 'tablePrefix' cannot be null."); Preconditions.checkState(!tablePrefix().isEmpty(), "Oracle 'tablePrefix' must not be an empty string."); Preconditions.checkState(!tablePrefix().startsWith("_"), "Oracle 'tablePrefix' cannot begin with underscore."); Preconditions.checkState(tablePrefix().endsWith("_"), "Oracle 'tablePrefix' must end with an underscore."); Preconditions.checkState( tablePrefix().length() <= AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH, "Oracle 'tablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH); Preconditions.checkState( !overflowTablePrefix().startsWith("_"), "Oracle 'overflowTablePrefix' cannot begin with underscore."); Preconditions.checkState( overflowTablePrefix().endsWith("_"), "Oracle 'overflowTablePrefix' must end with an underscore."); Preconditions.checkState( overflowTablePrefix().length() <= AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH, "Oracle 'overflowTablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH); Preconditions.checkState( overflowTablePrefix().length() <= AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH, "Oracle 'overflowTablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH); }

Target:
protected final void checkOracleConfig() { Preconditions.checkState(tablePrefix() != null, "Oracle 'tablePrefix' cannot be null."); Preconditions.checkState(!tablePrefix().isEmpty(), "Oracle 'tablePrefix' must not be an empty string."); Preconditions.checkState(!tablePrefix().startsWith("_"), "Oracle 'tablePrefix' cannot begin with underscore."); Preconditions.checkState(tablePrefix().endsWith("_"), "Oracle 'tablePrefix' must end with an underscore."); Preconditions.checkState( tablePrefix().length() <= AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH, "Oracle 'tablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH); Preconditions.checkState( !overflowTablePrefix().startsWith("_"), "Oracle 'overflowTablePrefix' cannot begin with underscore."); Preconditions.checkState( overflowTablePrefix().endsWith("_"), "Oracle 'overflowTablePrefix' must end with an underscore."); Preconditions.checkState( overflowTablePrefix().length() <= AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH, "Oracle 'overflowTablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH); }
Source:
private void updateGatewayInfoSynchronious() { deviceClient.setURI(this.gatewayInfoURI); String data = deviceClient.get().getResponseText(); JsonObject json = new JsonParser().parse(data).getAsJsonObject(); String firmwareVersion = json.get(VERSION).getAsString(); getThing().setProperty("firmwareVersion", firmwareVersion); deviceClient.setURI(gatewayURI); }

Target:
private void updateGatewayInfoSynchronious() { deviceClient.setURI(this.gatewayInfoURI); String data = deviceClient.get().getResponseText(); JsonObject json = new JsonParser().parse(data).getAsJsonObject(); String firmwareVersion = json.get(VERSION).getAsString(); getThing().setProperty(Thing.PROPERTY_FIRMWARE_VERSION, firmwareVersion); deviceClient.setURI(gatewayURI); }
Source:
public String getFormId() { FormDefinition def = renderingContext.getRootForm(); return renderingContext.getRootForm().getId(); }

Target:
public String getFormId() { return renderingContext.getRootForm().getId(); }
Source:
public Boolean validateQuery(String query) { try { Document document = Parser.parse(query); return true; } catch (Exception e) { return false; } }

Target:
public boolean validateQuery(String query) { try { Document document = Parser.parse(query); return true; } catch (Exception e) { return false; } }
Source:
public ResolveNodeResponse resolveNode(JsonRpcPeer peer, JSONObject params) throws JsonRpcException { ResolveNodeRequest request = mObjectMapper.convertValue(params, ResolveNodeRequest.class); Object object = mObjectIdMapper.getObjectForId(request.nodeId); int mappedObjectId = Runtime.mapObject(peer, object); Runtime.RemoteObject remoteObject = new Runtime.RemoteObject(); remoteObject.type = Runtime.ObjectType.OBJECT; remoteObject.subtype = Runtime.ObjectSubType.NODE; remoteObject.className = object.getClass().getName(); remoteObject.value = null; remoteObject.description = null; remoteObject.objectId = String.valueOf(mappedObjectId); ResolveNodeResponse response = new ResolveNodeResponse(); response.object = remoteObject; return response; }

Target:
public ResolveNodeResponse resolveNode(JsonRpcPeer peer, JSONObject params) throws JsonRpcException { ResolveNodeRequest request = mObjectMapper.convertValue(params, ResolveNodeRequest.class); Object object = mObjectIdMapper.getObjectForId(request.nodeId); int mappedObjectId = Runtime.mapObject(peer, object); Runtime.RemoteObject remoteObject = new Runtime.RemoteObject(); remoteObject.type = Runtime.ObjectType.OBJECT; remoteObject.subtype = Runtime.ObjectSubType.NODE; remoteObject.className = remoteObject.getClass().getName(); remoteObject.value = null; remoteObject.description = null; remoteObject.objectId = String.valueOf(mappedObjectId); ResolveNodeResponse response = new ResolveNodeResponse(); response.object = remoteObject; return response; }
Source:
public void doProbeBundle(Launchpad launchpad) { try { URL resource = Launchpad.class.getResource("/probe.jar"); Bundle probeBundle = launchpad.getFramework() .getBundleContext() .installBundle(resource.toString(), resource.openStream()); @SuppressWarnings("unchecked") Class<ProbeImpl> c = (Class<ProbeImpl>) probeBundle.loadClass(ProbeImpl.class.getName()); Probe probe = c.getDeclaredConstructor() .newInstance(); launchpad.setProbe(probe); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void doProbeBundle(Launchpad launchpad) { try { URL resource = Launchpad.class.getResource("/probe.jar"); Bundle probeBundle = launchpad.getFramework() .getBundleContext() .installBundle(resource.toString(), resource.openStream()); @SuppressWarnings("unchecked") Class<ProbeImpl> c = (Class<ProbeImpl>) probeBundle.loadClass(ProbeImpl.class.getName()); Probe probe = c.getConstructor() .newInstance(); launchpad.setProbe(probe); } catch (Exception e) { e.printStackTrace(); } }
Source:
public Node<View<?>, Edge> getParent(final double x, final double y) { final Optional<Node<View<?>, Edge>> parent = canvasHandler.getElementAt(x, y); return parent.isPresent() ? parent.get() : null; }

Target:
public Node<View<?>, Edge> getParent(final double x, final double y) { final Optional<Node<View<?>, Edge>> parent = canvasHandler.getElementAt(x, y); return parent.orElse(null); }
Source:
private final void onWatermark(long watermark, MessageCollector collector, TaskCoordinator coordinator) { final long inputWatermarkMin; if (prevOperators.isEmpty()) { inputWatermarkMin = watermark; } else { inputWatermarkMin = prevOperators.stream().map(op -> op.getOutputWatermark()).min(Long::compare).get(); } if (inputWatermark < inputWatermarkMin) { inputWatermark = inputWatermarkMin; LOG.trace("Advance input watermark to in operator {}", inputWatermark, getOperatorName()); final long outputWm; InitableFunction transformFn = getOperatorSpec().getTransformFn(); if (transformFn != null && transformFn instanceof WatermarkFunction) { WatermarkFunction watermarkFn = (WatermarkFunction) transformFn; watermarkFn.processWatermark(inputWatermark); outputWm = watermarkFn.getOutputWatermark(); } else { outputWm = handleWatermark(inputWatermark, collector, coordinator); } if (outputWatermark < outputWm) { outputWatermark = outputWm; LOG.debug("Advance output watermark to in operator {}", outputWatermark, getOperatorName()); this.registeredOperators.forEach(op -> op.onWatermark(outputWatermark, collector, coordinator)); } } }

Target:
private final void onWatermark(long watermark, MessageCollector collector, TaskCoordinator coordinator) { final long inputWatermarkMin; if (prevOperators.isEmpty()) { inputWatermarkMin = watermark; } else { inputWatermarkMin = prevOperators.stream().map(op -> op.getOutputWatermark()).min(Long::compare).get(); } if (inputWatermark < inputWatermarkMin) { inputWatermark = inputWatermarkMin; LOG.trace("Advance input watermark to in operator {}", inputWatermark, getOperatorName()); final Long outputWm; WatermarkFunction watermarkFn = getOperatorSpec().getWatermarkFn(); if (watermarkFn != null) { watermarkFn.processWatermark(inputWatermark); outputWm = watermarkFn.getOutputWatermark(); } else { outputWm = handleWatermark(inputWatermark, collector, coordinator); } propagateWatermark(outputWm, collector, coordinator); } }
Source:
public static byte[] fileToBytes(File path) throws IOException { FileInputStream fin = null; byte[] buffer = new byte[(int) path.length() + 1000]; int readBytes = 0; int totalBytes = 0; try { fin = new FileInputStream(path); while (readBytes >= 0) { totalBytes += readBytes; readBytes = fin.read(buffer, totalBytes, buffer.length - totalBytes - 1); } } catch(IOException ioe) { throw new IOException("File " + path.getAbsolutePath() + " is empty"); } finally { if (fin != null) { try { fin.close(); } catch (Exception e) } } byte[] bytes = Arrays.copyOf(buffer, totalBytes); return bytes; }

Target:
public static byte[] fileToBytes(File path) throws IOException { return Files.readAllBytes(path.toPath()); }
Source:
public static ByteRange fromOffsetRange(long startOffset, long endOffset) throws InvalidByteRangeException { if (startOffset < 0 || endOffset < 0 || endOffset < startOffset) { throw new InvalidByteRangeException(startOffset, endOffset); } return new ByteRange(startOffset, endOffset, ByteRangeType.OFFSET_RANGE); }

Target:
public static ByteRange fromOffsetRange(long startOffset, long endOffset) { if (startOffset < 0 || endOffset < startOffset) { throw new IllegalArgumentException( "Invalid range offsets provided for ByteRange; startOffset=" + startOffset + ", endOffset=" + endOffset); } return new ByteRange(startOffset, endOffset, ByteRangeType.OFFSET_RANGE); }
Source:
public void testEncodePositionSingle() throws Exception { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_SINGLE); Assert.assertEquals("(123456789012345AP00)", encoder.encodeCommand(command)); IdentityManager old = Context.getIdentityManager(); Context.init(t580wManager); try { Assert.assertEquals("[begin]sms2,*getposl*,[end]", encoder.encodeCommand(command)); } finally { Context.init(old); } }

Target:
public void testEncodePositionSingle() throws Exception { Tk103ProtocolEncoder encoder = new Tk103ProtocolEncoder(); Command command = new Command(); command.setDeviceId(1); command.setType(Command.TYPE_POSITION_SINGLE); Assert.assertEquals("(123456789012345AP00)", encoder.encodeCommand(command)); }
Source:
private RuleIteratorInternal createIterator() { try { setParameters(stmt); return new RuleIteratorInternal(stmt); } catch (SQLException e) { DatabaseUtils.closeQuietly(stmt); throw new IllegalStateException("Fail to prepare SQL request to select all issues", e); } }

Target:
private RuleIteratorInternal createIterator() { try { setParameters(stmt); return new RuleIteratorInternal(stmt); } catch (SQLException e) { DatabaseUtils.closeQuietly(stmt); throw new IllegalStateException("Fail to prepare SQL request to select all rules", e); } }
Source:
public boolean equals(final Object o) { if (o instanceof PatchListKey) { final PatchListKey k = (PatchListKey) o; return eq(oldId, k.oldId) && eq(newId, k.newId) && aPatchSetId == k.aPatchSetId && bPatchSetId == k.bPatchSetId && whitespace == k.whitespace; } return false; }

Target:
public boolean equals(final Object o) { if (o instanceof PatchListKey) { final PatchListKey k = (PatchListKey) o; return eq(oldId, k.oldId) && eq(newId, k.newId) && whitespace == k.whitespace; } return false; }
Source:
public List<Location> resolveList(Object l) { if (l==null) l = Collections.emptyList(); if (l instanceof String) l = JavaStringEscapes.unwrapJsonishListIfPossible((String)l); if (l instanceof Iterable) return resolve((Iterable<?>)l); throw new IllegalArgumentException("Location list must be supplied as a collection or a string, not "+l); }

Target:
public List<Location> resolveList(Object l) { if (l==null) l = Collections.emptyList(); if (l instanceof String) l = JavaStringEscapes.unwrapJsonishListIfPossible((String)l); if (l instanceof Iterable) return resolve((Iterable<?>)l); throw new IllegalArgumentException("Location list must be supplied as a collection or a string, not "+ JavaClassNames.simpleClassName(l)+"/"+l); }
Source:
public Map<String,Object> getDynamicTemplateData() { if(dynamicTemplateData == null) return Collections.<String,Object>emptyMap(); return dynamicTemplateData; }

Target:
public Map<String,Object> getDynamicTemplateData() { return dynamicTemplateData == null ? Collections.<String,Object>emptyMap() : dynamicTemplateData; }
Source:
private void buildVmDevicesFromDb(VmDeviceGeneralType generalType, boolean addAddress, Map<String, Object> extraSpecParams) { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdAndType(vm.getId(), generalType); for (VmDevice vmDevice : vmDevices) { Map struct = new HashMap(); struct.put(VdsProperties.Type, vmDevice.getType().getValue()); struct.put(VdsProperties.Device, vmDevice.getDevice()); Map<String, Object> specParams = vmDevice.getSpecParams(); if (extraSpecParams != null) { for (Map.Entry<String, Object> entry : extraSpecParams.entrySet()) { specParams.put(entry.getKey(), entry.getValue()); } } struct.put(VdsProperties.SpecParams, specParams); struct.put(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); if (addAddress) { addAddress(vmDevice, struct); } devices.add(struct); } }

Target:
private void buildVmDevicesFromDb(VmDeviceGeneralType generalType, boolean addAddress, Map<String, Object> extraSpecParams) { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdAndType(vm.getId(), generalType); for (VmDevice vmDevice : vmDevices) { Map struct = new HashMap(); struct.put(VdsProperties.Type, vmDevice.getType().getValue()); struct.put(VdsProperties.Device, vmDevice.getDevice()); Map<String, Object> specParams = vmDevice.getSpecParams(); if (extraSpecParams != null) { specParams.putAll(extraSpecParams); } struct.put(VdsProperties.SpecParams, specParams); struct.put(VdsProperties.DeviceId, String.valueOf(vmDevice.getId().getDeviceId())); if (addAddress) { addAddress(vmDevice, struct); } devices.add(struct); } }
Source:
public Menu generatePanelMenu(){ Menu panelMenu = new Menu("Panels"); Menu autoCreatePanelMenu = new Menu("Auto-create"); List<MenuItem> items = new ArrayList<>(); List<MenuItem> autoCreateItems = new ArrayList<>(); items.add(createLeftPanel()); items.add(createRightPanel()); items.add(closePanel()); autoCreateItems.add(createCustomizedPanel(ASSIGNEE_PANEL_NAME, ASSIGNEE_FILTER_NAME)); autoCreateItems.add(createCustomizedPanel(MILESTONE_PANEL_NAME, MILESTONE_FILTER_NAME)); autoCreateItems.add(createCustomizedPanel(UPDATED_PANEL_NAME, UPDATED_FILTER_NAME)); autoCreatePanelMenu.getItems().addAll(autoCreateItems); panelMenu.getItems().addAll(items); panelMenu.getItems().add(autoCreatePanelMenu); return panelMenu; }

Target:
public Menu generatePanelMenu(){ Menu panelMenu = new Menu("Panels"); Menu autoCreatePanelMenu = new Menu("Auto-create"); List<MenuItem> items = new ArrayList<>(); List<MenuItem> autoCreateItems = new ArrayList<>(); items.add(createLeftPanelMenuItem()); items.add(createRightPanelMenuItem()); items.add(closePanelMenuItem()); autoCreateItems.add(createCustomizedPanelMenuItem(ASSIGNEE_PANEL_NAME, ASSIGNEE_FILTER_NAME)); autoCreateItems.add(createCustomizedPanelMenuItem(MILESTONE_PANEL_NAME, MILESTONE_FILTER_NAME)); autoCreateItems.add(createCustomizedPanelMenuItem(UPDATED_PANEL_NAME, UPDATED_FILTER_NAME)); autoCreatePanelMenu.getItems().addAll(autoCreateItems); panelMenu.getItems().addAll(items); panelMenu.getItems().add(autoCreatePanelMenu); return panelMenu; }
Source:
public Appenderator createRealtimeAppenderatorForTask( String taskId, DataSchema schema, AppenderatorConfig config, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, ObjectMapper objectMapper, IndexIO indexIO, IndexMerger indexMerger, QueryRunnerFactoryConglomerate conglomerate, DataSegmentAnnouncer segmentAnnouncer, ServiceEmitter emitter, ExecutorService queryExecutorService, Cache cache, CacheConfig cacheConfig, CachePopulatorStats cachePopulatorStats ) { synchronized (this) { DatasourceBundle datasourceBundle = datasourceBundles.computeIfAbsent( schema.getDataSource(), (datasource) -> { return new DatasourceBundle(datasource); } ); Appenderator appenderator = new AppenderatorImpl( schema, rewriteAppenderatorConfigMemoryLimits(config), metrics, dataSegmentPusher, objectMapper, segmentAnnouncer, datasourceBundle.getWalker(), indexIO, wrapIndexMerger(indexMerger), cache ); datasourceBundle.addAppenderator(taskId, appenderator); return appenderator; } }

Target:
public Appenderator createRealtimeAppenderatorForTask( String taskId, DataSchema schema, AppenderatorConfig config, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, ObjectMapper objectMapper, IndexIO indexIO, IndexMerger indexMerger, QueryRunnerFactoryConglomerate conglomerate, DataSegmentAnnouncer segmentAnnouncer, ServiceEmitter emitter, ExecutorService queryExecutorService, Cache cache, CacheConfig cacheConfig, CachePopulatorStats cachePopulatorStats ) { synchronized (this) { DatasourceBundle datasourceBundle = datasourceBundles.computeIfAbsent( schema.getDataSource(), DatasourceBundle::new ); Appenderator appenderator = new AppenderatorImpl( schema, rewriteAppenderatorConfigMemoryLimits(config), metrics, dataSegmentPusher, objectMapper, segmentAnnouncer, datasourceBundle.getWalker(), indexIO, wrapIndexMerger(indexMerger), cache ); datasourceBundle.addAppenderator(taskId, appenderator); return appenderator; } }
Source:
public void goToLastEvent() throws CTFException { long endTime = Long.MIN_VALUE; for (CTFStreamInputReader sir : fPrio) { sir.goToLastEvent(); IEventDefinition currentEvent = sir.getCurrentEvent(); if (currentEvent != null) { endTime = Math.max(currentEvent.getTimestamp(), endTime); } } setEndTime(fTrace.timestampCyclesToNanos(endTime)); seek(endTime - 1); }

Target:
public void goToLastEvent() throws CTFException { long endTime = Long.MIN_VALUE; for (CTFStreamInputReader sir : fPrio) { sir.goToLastEvent(); IEventDefinition currentEvent = sir.getCurrentEvent(); if (currentEvent != null) { endTime = Math.max(currentEvent.getTimestamp(), endTime); } } setEndTime(fTrace.timestampCyclesToNanos(endTime)); seek(getEndTime()); }
Source:
public Mono<Integer> readMinThroughput() { return this.read().flatMap(cosmosContainerResponse -> database.getDocClientWrapper() .queryOffers("select * from c where c.offerResourceId = '" + cosmosContainerResponse.resourceSettings().resourceId() + "'", new FeedOptions()) .single()).flatMap(offerFeedResponse -> { if (offerFeedResponse.results().isEmpty()) { return Mono.error(BridgeInternal.createCosmosClientException(HttpConstants.StatusCodes.BADREQUEST, "No offers found for the resource")); } return database.getDocClientWrapper().readOffer(offerFeedResponse.results().get(0).selfLink()) .single(); }).map(cosmosOfferResponse -> Integer.parseInt(cosmosOfferResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.OFFER_MIN_THROUGHPUT))); }

Target:
public Mono<Integer> readMinThroughput() { return this.read().flatMap(cosmosContainerResponse -> database.getDocClientWrapper() .queryOffers( new SqlQuerySpec("select * from c where c.offerResourceId = @OFFER_RESOURCE_ID", new SqlParameterList(new SqlParameter("@OFFER_RESOURCE_ID", cosmosContainerResponse.resourceSettings().resourceId()))), new FeedOptions()) .single()).flatMap(offerFeedResponse -> { if (offerFeedResponse.results().isEmpty()) { return Mono.error(BridgeInternal.createCosmosClientException(HttpConstants.StatusCodes.BADREQUEST, "No offers found for the resource")); } return database.getDocClientWrapper().readOffer(offerFeedResponse.results().get(0).selfLink()) .single(); }).map(cosmosOfferResponse -> Integer.parseInt(cosmosOfferResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.OFFER_MIN_THROUGHPUT))); }
Source:
public void testQueryDocumentExpiration() throws CouchbaseLiteException, Exception { Date dto5 = new Date(System.currentTimeMillis() + 500L); Date dto10 = new Date(System.currentTimeMillis() + 2000L); Date dto20 = new Date(System.currentTimeMillis() + 2000L); Date dto30 = new Date(System.currentTimeMillis() + 3000L); Date dto40 = new Date(System.currentTimeMillis() + 4000L); long dto60InMS = System.currentTimeMillis() + 6000L; MutableDocument doc1 = new MutableDocument("doc"); MutableDocument doc10 = new MutableDocument("doc10"); MutableDocument doc1a = new MutableDocument("doc1"); MutableDocument doc1b = new MutableDocument("doc2"); MutableDocument doc1c = new MutableDocument("doc3"); doc1.setInt("answer", 42); doc1.setString("notHere", "string"); save(doc1); doc10.setInt("answer", 42); doc10.setString("notHere", "string"); save(doc10); db.setDocumentExpiration("doc10", dto10); db.delete(doc10); doc1a.setInt("answer", 42); doc1a.setString("a", "string"); save(doc1a); doc1b.setInt("answer", 42); doc1b.setString("b", "string"); save(doc1b); doc1c.setInt("answer", 42); doc1c.setString("c", "string"); save(doc1c); db.setDocumentExpiration("doc", dto5); db.setDocumentExpiration("doc1", dto20); db.setDocumentExpiration("doc2", dto30); db.setDocumentExpiration("doc3", dto40); Thread.sleep(1000); Query query = QueryBuilder.select(SR_DOCID, SR_EXPIRATION) .from(DataSource.database(db)) .where(Meta.expiration .lessThan(Expression.longValue(dto60InMS))); assertEquals(query.execute().allResults().size(), 3); }

Target:
public void testQueryDocumentExpiration() throws CouchbaseLiteException, Exception { Date dto5 = new Date(System.currentTimeMillis() + 500L); Date dto20 = new Date(System.currentTimeMillis() + 2000L); Date dto30 = new Date(System.currentTimeMillis() + 3000L); Date dto40 = new Date(System.currentTimeMillis() + 4000L); long dto60InMS = System.currentTimeMillis() + 6000L; MutableDocument doc = new MutableDocument("doc"); MutableDocument doc10 = new MutableDocument("doc10"); MutableDocument doc1 = new MutableDocument("doc1"); MutableDocument doc2 = new MutableDocument("doc2"); MutableDocument doc3 = new MutableDocument("doc3"); doc.setInt("answer", 42); doc.setString("notHere", "string"); save(doc); doc10.setInt("answer", 42); doc10.setString("notHere", "string"); save(doc10); db.setDocumentExpiration("doc10", dto20); db.delete(doc20); doc1.setInt("answer", 42); doc1.setString("a", "string"); save(doc1); doc2.setInt("answer", 42); doc2.setString("b", "string"); save(doc2); doc3.setInt("answer", 42); doc3.setString("c", "string"); save(doc3); db.setDocumentExpiration("doc", dto5); db.setDocumentExpiration("doc1", dto20); db.setDocumentExpiration("doc2", dto30); db.setDocumentExpiration("doc3", dto40); Thread.sleep(1000); Query query = QueryBuilder.select(SR_DOCID, SR_EXPIRATION) .from(DataSource.database(db)) .where(Meta.expiration .lessThan(Expression.longValue(dto60InMS))); assertEquals(query.execute().allResults().size(), 3); }
Source:
public Iterable<ConnectorFactory> getConnectorFactories() { return ImmutableList.of(new HiveConnectorFactory(name, getClassLoader(), Optional.of(metastore))); }

Target:
public Iterable<ConnectorFactory> getConnectorFactories() { return ImmutableList.of(new HiveConnectorFactory(name, getClassLoader(), metastore)); }
Source:
public DeclarationsSearchGroup(IWorkbenchSite site, IDLTKLanguageToolkit tk) { fSite = site; this.toolkit = tk; fGroupId = IContextMenuConstants.GROUP_SEARCH; fFindDeclarationsAction = new FindDeclarationsAction(toolkit, site); fFindDeclarationsAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE); fFindDeclarationsInProjectAction = new FindDeclarationsInProjectAction( toolkit, site); fFindDeclarationsInProjectAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS); fFindDeclarationsInHierarchyAction = new FindDeclarationsInHierarchyAction( toolkit, site); fFindDeclarationsInHierarchyAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY); fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction( toolkit, site); fFindDeclarationsInWorkingSetAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET); fSelectionProvider = fSite.getSelectionProvider(); fRegisterInProvider = true; registerActions(); }

Target:
public DeclarationsSearchGroup(IWorkbenchSite site, IDLTKLanguageToolkit tk) { fSite = site; this.toolkit = tk; fGroupId = IContextMenuConstants.GROUP_SEARCH; fFindDeclarationsAction = new FindDeclarationsAction(toolkit, site); fFindDeclarationsAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKSPACE); fFindDeclarationsInProjectAction = new FindDeclarationsInProjectAction( toolkit, site); fFindDeclarationsInProjectAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_PROJECTS); fFindDeclarationsInHierarchyAction = new FindDeclarationsInHierarchyAction( toolkit, site); fFindDeclarationsInHierarchyAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_HIERARCHY); fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction( toolkit, site); fFindDeclarationsInWorkingSetAction.setActionDefinitionId(IScriptEditorActionDefinitionIds.SEARCH_DECLARATIONS_IN_WORKING_SET); fSelectionProvider = fSite.getSelectionProvider(); assert fSelectionProvider != null; registerActions(); }
Source:
CorfuStreamEntry<K, V, M> fromSMREntry(SMREntry entry, @Nonnull final long epoch, @Nonnull final Class<K> keyClass, @Nonnull final Class<V> payloadClass, @Nullable final Class<M> metadataClass) { long address = entry.getGlobalAddress(); OperationType operationType; log.trace("fromSRMEntry: Table streamer got SMR {}", keyClass.getName(), entry.getSMRMethod()); switch(entry.getSMRMethod()) { case "put": operationType = OperationType.UPDATE; break; case "clear": operationType = OperationType.CLEAR; break; default: operationType = OperationType.DELETE; break; } Object[] args = entry.getSMRArguments(); log.trace("Converting SMREntry at address to CorfuStreamEntry: Operation: Length of arguments: {}. " + "({} -> {}, {})", address, operationType, args.length, keyClass.getCanonicalName(), payloadClass.getCanonicalName(), (metadataClass != null) ? metadataClass.getCanonicalName() : "null"); K key = null; V payload = null; M metadata = null; if (args.length > 0) { key = (K) args[0]; if (args.length > 1) { CorfuRecord record = (CorfuRecord) args[1]; payload = (V) record.getPayload(); metadata = (M) record.getMetadata(); } } return new CorfuStreamEntry<K, V, M>(key, payload, metadata, epoch, address, operationType); }

Target:
CorfuStreamEntry<K, V, M> fromSMREntry(SMREntry entry, @Nonnull final long epoch, @Nonnull final Class<K> keyClass, @Nonnull final Class<V> payloadClass, @Nullable final Class<M> metadataClass) { long address = entry.getGlobalAddress(); OperationType operationType; log.trace("fromSRMEntry: Table streamer got SMR {}", keyClass.getName(), entry.getSMRMethod()); switch(entry.getSMRMethod()) { case "put": case "putAll": operationType = OperationType.UPDATE; break; case "clear": operationType = OperationType.CLEAR; break; case "remove": operationType = OperationType.DELETE; break; default: throw new RuntimeException("SMRMethod "+entry.getSMRMethod() + " cannot be translated to CorfuStreamEntry"); } Object[] args = entry.getSMRArguments(); log.trace("Converting SMREntry at address to CorfuStreamEntry: Operation: Length of arguments: {}. " + "({} -> {}, {})", address, operationType, args.length, keyClass.getCanonicalName(), payloadClass.getCanonicalName(), (metadataClass != null) ? metadataClass.getCanonicalName() : "null"); K key = null; V payload = null; M metadata = null; if (args.length > 0) { key = (K) args[0]; if (args.length > 1) { CorfuRecord record = (CorfuRecord) args[1]; payload = (V) record.getPayload(); metadata = (M) record.getMetadata(); } } return new CorfuStreamEntry<K, V, M>(key, payload, metadata, epoch, address, operationType); }
Source:
public AsynchronousFileChannel newAsynchronousFileChannel(final Path path, final Set<? extends OpenOption> options, final ExecutorService executor, FileAttribute<?>... attrs) { checkNotNull("path", path); throw new UnsupportedOperationException(); }

Target:
public AsynchronousFileChannel newAsynchronousFileChannel(final Path path, final Set<? extends OpenOption> options, final ExecutorService executor, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException { checkNotNull("path", path); throw new UnsupportedOperationException(); }
Source:
public String generate(final U profile) { try { final JWSSigner signer = new MACSigner(this.secret); final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder() .subject(profile.getTypedId()) .issueTime(new Date()) .issuer(this.getClass().getSimpleName()); final Map<String, Object> attributes = profile.getAttributes(); for (final String key : attributes.keySet()) { builder.claim(key, attributes.get(key)); } final JWTClaimsSet claims = builder.build(); final SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256, JOSEObjectType.JWT, null, null, null, null, null, null, null, null, null, null, null), claims); signedJWT.sign(signer); if (encrypted) { final JWEObject jweObject = new JWEObject( new JWEHeader.Builder(JWEAlgorithm.DIR, EncryptionMethod.A256GCM).contentType("JWT").build(), new Payload(signedJWT)); jweObject.encrypt(new DirectEncrypter(this.secret.getBytes("UTF-8"))); return jweObject.serialize(); } else { return signedJWT.serialize(); } } catch (final Exception e) { throw new TechnicalException("Cannot generate JWT", e); } }

Target:
public String generate(final U profile) { try { final JWSSigner signer = new MACSigner(this.secret); final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder() .subject(profile.getTypedId()) .issueTime(new Date()) .issuer(this.getClass().getSimpleName()); final Map<String, Object> attributes = profile.getAttributes(); for (final String key : attributes.keySet()) { builder.claim(key, attributes.get(key)); } final JWTClaimsSet claims = builder.build(); final SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claims); signedJWT.sign(signer); if (encrypted) { final JWEObject jweObject = new JWEObject( new JWEHeader.Builder(JWEAlgorithm.DIR, EncryptionMethod.A256GCM).contentType("JWT").build(), new Payload(signedJWT)); jweObject.encrypt(new DirectEncrypter(this.secret.getBytes("UTF-8"))); return jweObject.serialize(); } else { return signedJWT.serialize(); } } catch (final Exception e) { throw new TechnicalException("Cannot generate JWT", e); } }
Source:
protected void onConstructorFound(NewClassTree newClassTree) { ClassTree classTree = newClassTree.classBody(); if (classTree == null) { return; } List<Tree> members = classTree.members(); if (members.size() != 1) { return; } members.stream() .filter(tree -> tree.is(Tree.Kind.METHOD)) .map(t -> ((MethodTree) t)) .filter(t -> "initialValue".equals(t.simpleName().name())) .findFirst().ifPresent( t -> reportIssue(newClassTree.identifier(), "Replace this anonymous class with a call to \"ThreadLocal.withInitial\".") ); }

Target:
protected void onConstructorFound(NewClassTree newClassTree) { ClassTree classTree = newClassTree.classBody(); if (classTree == null) { return; } List<Tree> members = classTree.members(); if (members.size() != 1) { return; } members.stream() .filter(tree -> tree.is(Tree.Kind.METHOD)) .map(t -> ((MethodTree) t)) .filter(t -> "initialValue".equals(t.simpleName().name())) .filter(t -> t.parameters().isEmpty()) .findFirst().ifPresent( t -> reportIssue(newClassTree.identifier(), "Replace this anonymous class with a call to \"ThreadLocal.withInitial\"."+context.getJavaVersion().java8CompatibilityMessage()) ); }
Source:
public GitHubBranchCause check(GitHubBranchTrigger trigger, GHBranch remoteBranch, @CheckForNull GitHubBranch localBranch, GitHubBranchRepository localRepo, TaskListener listener) throws IOException { Function<GitHubBranchCommitCheck, GitHubBranchCause> function; if (localBranch == null) { GHCommit commit = getLastCommit(remoteBranch); function = event -> event.check(remoteBranch, localRepo, commit); } else { GHCompare.Commit[] commits = getComparedCommits(localBranch, remoteBranch); function = event -> event.check(remoteBranch, localRepo, commits); } return check(remoteBranch, function); }

Target:
public GitHubBranchCause check(GitHubBranchTrigger trigger, GHBranch remoteBranch, @CheckForNull GitHubBranch localBranch, GitHubBranchRepository localRepo, TaskListener listener) throws IOException { final PrintStream logger = listener.getLogger(); Function<GitHubBranchCommitCheck, GitHubBranchCause> function; if (localBranch == null) { GHCommit commit = getLastCommit(remoteBranch); function = event -> event.check(remoteBranch, localRepo, commit); } else { GHCompare.Commit[] commits = getComparedCommits(localBranch, remoteBranch); function = event -> event.check(remoteBranch, localRepo, commits); } return check(remoteBranch, function, logger); }
Source:
public static CopyFilter getCopyFilter(Configuration conf) { String filtersClassName = conf.get(DistCpConstants.CONF_LABEL_FILTERS_CLASS); if (filtersClassName != null) { try { Class<? extends CopyFilter> filtersClass = conf.getClassByName(filtersClassName).asSubclass(CopyFilter.class); filtersClassName = filtersClass.getName(); Constructor<? extends CopyFilter> constructor = filtersClass.getDeclaredConstructor(Configuration.class); return constructor.newInstance(conf); } catch (Exception e) { LOG.error("Unable to instantiate " + filtersClassName, e); } } return getDefaultCopyFilter(conf); }

Target:
public static CopyFilter getCopyFilter(Configuration conf) { String filtersClassName = conf .get(DistCpConstants.CONF_LABEL_FILTERS_CLASS); if (filtersClassName != null) { try { Class<? extends CopyFilter> filtersClass = conf .getClassByName(filtersClassName) .asSubclass(CopyFilter.class); filtersClassName = filtersClass.getName(); Constructor<? extends CopyFilter> constructor = filtersClass .getDeclaredConstructor(Configuration.class); return constructor.newInstance(conf); } catch (Exception e) { LOG.error(DistCpConstants.CLASS_INSTANTIATION_ERROR_MSG + filtersClassName, e); throw new RuntimeException( DistCpConstants.CLASS_INSTANTIATION_ERROR_MSG + filtersClassName, e); } } else { return getDefaultCopyFilter(conf); } }
Source:
public Group getCurrentRecord() { SimpleGroup simpleGroup = (SimpleGroup) root.getCurrentRecord(); return simpleGroup.isNull() ? null : simpleGroup; }

Target:
public Group getCurrentRecord() { return root.getCurrentRecord(); }
Source:
private static Collection<Symbol> symbolsFromConditionsNotUpdated(ForStatementTree forStatementTree) { Collection<Symbol> conditionSymbols = getConditionSymbols(forStatementTree.condition()); Collection<Symbol> updateSymbols = getUpdatedSymbols(forStatementTree.update()); return conditionSymbols.stream().filter(s -> !updateSymbols.contains(s)).collect(Collectors.toSet()); }

Target:
private static Collection<Symbol> symbolsFromConditionsNotUpdated(ForStatementTree forStatementTree) { Collection<Symbol> symbols = getConditionSymbols(forStatementTree.condition()); symbols.removeAll(getUpdatedSymbols(forStatementTree.update())); return symbols; }
Source:
public final Response exit(final Response response, final Identity identity) throws IOException { return response; }

Target:
public final Response exit(final Response response, final Identity identity) throws IOException { if (this.index < this.all.size()) { return this.all.get(this.index).exit(response, identity); } else { throw new IOException( "Index of identity is greater than Pass collection size" ); } }
Source:
private Optional<ClusterProxyError> deserializeAsClusterProxyError(Response response) { ClusterProxyError clusterProxyError; try { clusterProxyError = response.readEntity(ClusterProxyError.class); if (!clusterProxyError.getCode().contains("cluster-proxy")) { return Optional.empty(); } } catch (Exception ex) { return Optional.empty(); } return Optional.of(clusterProxyError); }

Target:
private Optional<ClusterProxyError> deserializeAsClusterProxyError(Response response) { try { ClusterProxyError clusterProxyError = response.readEntity(ClusterProxyError.class); if (clusterProxyError.getCode().contains("cluster-proxy")) { return Optional.of(clusterProxyError); } else { return Optional.empty(); } } catch (Exception ex) { return Optional.empty(); } }