auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public QueryRequest process(QueryRequest input) throws PluginExecutionException, StopProcessingException { QueryTypeFilterDelegate queryType = new QueryTypeFilterDelegate(); Set<String> sourceIds = getSourceIds(input); try { filterAdapter.adapt(input.getQuery(), queryType); if (queryType.isComparison()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "comparison")); } if (queryType.isSpatial()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "spatial")); } if (queryType.isFuzzy()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "fuzzy")); } if (queryType.isTemporal()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "temporal")); } if (queryType.isFunction()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "function")); } if (isNone(queryType)) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "none")); } } catch (UnsupportedQueryException e) { } addStartTime(input); return input; }

Target:
public QueryRequest process(QueryRequest input) throws PluginExecutionException, StopProcessingException { QueryTypeFilterDelegate queryType = new QueryTypeFilterDelegate(); Set<String> sourceIds = getSourceIds(input); try { filterAdapter.adapt(input.getQuery(), queryType); if (queryType.isComparison()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "comparison")); } if (queryType.isSpatial()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "spatial")); } if (queryType.isFuzzy()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "fuzzy")); } if (queryType.isTemporal()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "temporal")); } if (queryType.isFunction()) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "function")); } if (isNone(queryType)) { sourceIds.forEach(sourceId -> incrementCounter(sourceId, "none")); } } catch (UnsupportedQueryException e) { LOGGER.debug("Unable to detect query type due to unsupported query.", e); sourceIds.forEach(sourceId -> incrementCounter(sourceId, "unsupported")); } addStartTime(input); return input; }
Source:
public BreakButtonsUI(String name, BreakPanelToolbarFactory breakToolbarFactory) { requestButton = breakToolbarFactory.getBtnBreakRequest(); responseButton = breakToolbarFactory.getBtnBreakResponse(); allButton = breakToolbarFactory.getBtnBreakAll(); brkOnJsButton = breakToolbarFactory.getBtnBreakOnJavaScript(); brkOnCSSAndFontsButton = breakToolbarFactory.getBtnBreakOnCSSAndFonts(); brkOnMultimediaButton = breakToolbarFactory.getBtnBreakOnMultimedia(); brkOnlyOnScopeButton = breakToolbarFactory.getBtnOnlyBreakOnScope(); toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setBorder(BorderFactory.createEmptyBorder()); toolBar.setRollover(true); toolBar.setName(name); toolBar.add(requestButton); toolBar.add(responseButton); toolBar.add(allButton); toolBar.add(breakToolbarFactory.getBtnStep()); toolBar.add(breakToolbarFactory.getBtnContinue()); toolBar.add(breakToolbarFactory.getBtnDrop()); toolBar.add(breakToolbarFactory.getBtnBreakPoint()); toolBar.add(brkOnJsButton); toolBar.add(brkOnCSSAndFontsButton); toolBar.add(brkOnMultimediaButton); toolBar.add(brkOnlyOnScopeButton); }

Target:
public BreakButtonsUI(String name, BreakPanelToolbarFactory breakToolbarFactory) { requestButton = breakToolbarFactory.getBtnBreakRequest(); responseButton = breakToolbarFactory.getBtnBreakResponse(); allButton = breakToolbarFactory.getBtnBreakAll(); separatorForBreakOnButtons = new JToolBar.Separator(); brkOnJavaScriptButton = breakToolbarFactory.getBtnBreakOnJavaScript(); brkOnCssAndFontsButton = breakToolbarFactory.getBtnBreakOnCssAndFonts(); brkOnMultimediaButton = breakToolbarFactory.getBtnBreakOnMultimedia(); separatorForBreakOnlyScopeButton = new JToolBar.Separator(); brkOnlyOnScopeButton = breakToolbarFactory.getBtnOnlyBreakOnScope(); toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setBorder(BorderFactory.createEmptyBorder()); toolBar.setRollover(true); toolBar.setName(name); toolBar.add(requestButton); toolBar.add(responseButton); toolBar.add(allButton); toolBar.add(breakToolbarFactory.getBtnStep()); toolBar.add(breakToolbarFactory.getBtnContinue()); toolBar.add(breakToolbarFactory.getBtnDrop()); toolBar.add(breakToolbarFactory.getBtnBreakPoint()); toolBar.add(separatorForBreakOnButtons); toolBar.add(brkOnJavaScriptButton); toolBar.add(brkOnCssAndFontsButton); toolBar.add(brkOnMultimediaButton); toolBar.add(separatorForBreakOnlyScopeButton); toolBar.add(brkOnlyOnScopeButton); }
Source:
public void send(RiemannEvent event) { try { EventDSL eventDSL = createEvent() .description(event.description) .service(machineName + " " + event.service) .state(event.state) .time(System.currentTimeMillis() / 1000L) .metric(event.metric) .ttl(event.ttl == null ? DEFAULT_TTL_SEC : event.ttl) .tag("storm") .tags(event.tags) .attributes(event.customAttributes); if(event.host != null) { eventDSL.host(event.host); } logger.debug("Event sent - {}", event); eventDSL.send(); } catch (Throwable t) { logger.warn("Riemann error during event ("+ event.description+") send attempt: ", t); } }

Target:
public void send(RiemannEvent event) { try { EventDSL eventDSL = createEvent() .description(event.description) .service(machineName + " " + event.service) .state(event.state) .time(System.currentTimeMillis() / 1000L) .metric(event.metric) .ttl(event.ttl == null ? DEFAULT_TTL_SEC : event.ttl) .tag("storm") .tags(event.tags) .attributes(event.customAttributes); if(event.host != null) { eventDSL.host(event.host); } eventDSL.send(); if (logger.isDebugEnabled()) { logger.debug("Event sent - {}", event); } } catch (Throwable t) { logger.warn("Riemann error during event ("+ event.description+") send attempt: ", t); } }
Source:
public void setup() throws Exception { discoverListener = PowerMockito.spy(new MyDiscoverListener()); listeners.add(discoverListener); nodeDiscovery = PowerMockito.spy(new NodeDiscovery(Mockito.mock(XBeeDevice.class))); PowerMockito.doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); RemoteXBeeDevice remote = (RemoteXBeeDevice) args[1]; discoverListener.deviceDiscovered(remote); return null; } }).when(nodeDiscovery, NOTIFY_DEVICE_DISCOVERED, Mockito.any(ArrayList.class), (RemoteXBeeDevice) Mockito.any()); PowerMockito.doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); String error = (String) args[1]; discoverListener.discoveryError(error); return null; } }).when(nodeDiscovery, NOTIFY_DISCOVERY_ERROR, Mockito.any(ArrayList.class), Mockito.anyString()); PowerMockito.doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); String error = (String) args[1]; discoverListener.discoveryFinished(error); return null; } }).when(nodeDiscovery, NOTIFY_DISCOVERY_FINISHED, Mockito.any(ArrayList.class), Mockito.anyString()); }

Target:
public void setup() throws Exception { discoverListener = PowerMockito.spy(new MyDiscoverListener()); listeners.add(discoverListener); nodeDiscovery = PowerMockito.spy(new NodeDiscovery(Mockito.mock(XBeeDevice.class))); PowerMockito.doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); RemoteXBeeDevice remote = (RemoteXBeeDevice) args[1]; discoverListener.deviceDiscovered(remote); return null; } }).when(nodeDiscovery, NOTIFY_DEVICE_DISCOVERED, Mockito.any(List.class), (RemoteXBeeDevice) Mockito.any()); PowerMockito.doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); String error = (String) args[1]; discoverListener.discoveryError(error); return null; } }).when(nodeDiscovery, NOTIFY_DISCOVERY_ERROR, Mockito.any(List.class), Mockito.anyString()); PowerMockito.doAnswer(new Answer<Object>() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); String error = (String) args[1]; discoverListener.discoveryFinished(error); return null; } }).when(nodeDiscovery, NOTIFY_DISCOVERY_FINISHED, Mockito.any(List.class), Mockito.anyString()); }
Source:
public Map<String, String> getHeaders() { Map<String, String> headers = new HashMap<>(); Optional.ofNullable(idempotencyKey).ifPresent(idempotencyKey -> headers.put("Idempotency-Key", idempotencyKey)); headers.putAll(AuthUtil.getStripeAuthHeader(stripeGatewayConfig, gatewayAccount.isLive())); return headers; }

Target:
public Map<String, String> getHeaders() { Map<String, String> headers = new HashMap<>(); Optional.ofNullable(idempotencyKey).ifPresent(key -> headers.put("Idempotency-Key", key)); headers.putAll(AuthUtil.getStripeAuthHeader(stripeGatewayConfig, gatewayAccount.isLive())); return headers; }
Source:
@Test public void testInterceptSource() { String srcRegex = "word1"; String replaceString = "word2"; RegexMountPointResolvedDstPathReplaceInterceptor interceptor = new RegexMountPointResolvedDstPathReplaceInterceptor(srcRegex, replaceString); String sourcePath = "/a/b/l3/dd"; sourcePath = interceptor.interceptSource(sourcePath); }

Target:
public void testInterceptSource() { String srcRegex = "word1"; String replaceString = "word2"; RegexMountPointResolvedDstPathReplaceInterceptor interceptor = new RegexMountPointResolvedDstPathReplaceInterceptor(srcRegex, replaceString); String sourcePath = "/a/b/l3/dd"; Assert.assertEquals(sourcePath, interceptor.interceptSource(sourcePath)); }
Source:
public static String map(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage hookStage, String template) { switch (hookStage) { case POST: return org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage.POST.toString(); case PRE: return org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage.PRE.toString(); default: return null; } }

Target:
public static String map(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage hookStage, String template) { switch (hookStage) { case POST: return Stage.POST.toString(); case PRE: return Stage.PRE.toString(); default: return null; } }
Source:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(getVmPool()); setPoolBeingDestroyed(); setPrestartedToZero(); getCompensationContext().stateChanged(); return null; } }); setCommandShouldBeLogged(false); log(); stopVms(); if (allVmsDown) { getParameters().setTaskGroupSuccess(true); endSuccessfully(); } else { setSucceeded(true); } }

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntity(getVmPool()); setPoolBeingDestroyed(); setPrestartedToZero(); getCompensationContext().stateChanged(); return null; } }); setCommandShouldBeLogged(false); log(); stopVms(); if (allVmsDown) { endSuccessfully(); } else { setSucceeded(true); } }
Source:
private void classifyNics(List<Bond> nonEmptyBonds, List<Nic> independentNics, Map<String, List<Nic>> bondToNics, Map<String, List<Vlan>> nicToVlans) { for (VdsNetworkInterface i : getOriginalItems()) { if (i instanceof Bond) { nonEmptyBonds.add((Bond) i); } else if (i instanceof Nic) { if (i.getBondName() == null) { independentNics.add((Nic) i); } else { if (bondToNics.containsKey(i.getBondName())) { bondToNics.get(i.getBondName()).add((Nic) i); } else { List<Nic> nicList = new ArrayList<Nic>(); nicList.add((Nic) i); bondToNics.put(i.getBondName(), nicList); } } } else { String nameWithoutVlan = i.getName().substring(0, i.getName().lastIndexOf('.')); if (nicToVlans.containsKey(nameWithoutVlan)) { nicToVlans.get(nameWithoutVlan).add((Vlan) i); } else { List<Vlan> vlanList = new ArrayList<Vlan>(); vlanList.add((Vlan) i); nicToVlans.put(nameWithoutVlan, vlanList); } } } }

Target:
private void classifyNics(List<Bond> nonEmptyBonds, List<Nic> independentNics, Map<String, List<Nic>> bondToNics, Map<String, List<Vlan>> nicToVlans) { for (VdsNetworkInterface nic : getOriginalItems()) { if (nic instanceof Bond) { nonEmptyBonds.add((Bond) nic); } else if (nic instanceof Nic) { if (nic.getBondName() == null) { independentNics.add((Nic) nic); } else { if (bondToNics.containsKey(nic.getBondName())) { bondToNics.get(nic.getBondName()).add((Nic) nic); } else { List<Nic> nicList = new ArrayList<Nic>(); nicList.add((Nic) nic); bondToNics.put(nic.getBondName(), nicList); } } } else if (nic instanceof Vlan) { String nameWithoutVlan = nic.getName().substring(0, nic.getName().lastIndexOf('.')); if (nicToVlans.containsKey(nameWithoutVlan)) { nicToVlans.get(nameWithoutVlan).add((Vlan) nic); } else { List<Vlan> vlanList = new ArrayList<Vlan>(); vlanList.add((Vlan) nic); nicToVlans.put(nameWithoutVlan, vlanList); } } } }
Source:
public InputStatus pollNext(ReaderOutput<Integer> sourceOutput) throws Exception { boolean finished = !waitingForMoreSplits; currentSplitIndex = 0; while (currentSplitIndex < assignedSplits.size() && !assignedSplits.get(currentSplitIndex).isAvailable()) { finished &= assignedSplits.get(currentSplitIndex).isFinished(); currentSplitIndex++; } if (currentSplitIndex < assignedSplits.size()) { sourceOutput.collect(assignedSplits.get(currentSplitIndex).getNext(false)[0]); return InputStatus.MORE_AVAILABLE; } else { if (finished) { return InputStatus.END_OF_INPUT; } else { if (markIdleOnNoSplits) { sourceOutput.markIdle(); } markUnavailable(); return InputStatus.NOTHING_AVAILABLE; } } }

Target:
public InputStatus pollNext(ReaderOutput<Integer> sourceOutput) throws Exception { boolean finished = !waitingForMoreSplits; currentSplitIndex = 0; while (currentSplitIndex < assignedSplits.size() && !assignedSplits.get(currentSplitIndex).isAvailable()) { finished &= assignedSplits.get(currentSplitIndex).isFinished(); currentSplitIndex++; } if (currentSplitIndex < assignedSplits.size()) { sourceOutput.collect(assignedSplits.get(currentSplitIndex).getNext(false)[0]); return InputStatus.MORE_AVAILABLE; } else if (finished) { return InputStatus.END_OF_INPUT; } else { if (markIdleOnNoSplits) { sourceOutput.markIdle(); } markUnavailable(); return InputStatus.NOTHING_AVAILABLE; } }
Source:
public StreamingAppMasterService(ApplicationAttemptId appAttemptID) { super(StreamingAppMasterService.class.getName()); this.appAttemptID = appAttemptID; Integer nodeManagerKillTimeout = Integer.getInteger("org.apache.apex.nodemanager.kill.timeout"); if (nodeManagerKillTimeout != null) { REMOVE_CONTAINER_TIMEOUT = nodeManagerKillTimeout; } else { REMOVE_CONTAINER_TIMEOUT = 30 * 1000; } }

Target:
public StreamingAppMasterService(ApplicationAttemptId appAttemptID) { super(StreamingAppMasterService.class.getName()); this.appAttemptID = appAttemptID; }
Source:
public NetworkView mapRow(ResultSet rs, int rowNum) throws SQLException { NetworkView entity = new NetworkView(); Network network = new Network(); network.setId(Guid.createGuidFromString(rs.getString("network_id"))); network.setname(rs.getString("network_name")); network.setdescription(rs.getString("network_description")); network.settype((Integer) rs.getObject("network_type")); network.setaddr(rs.getString("addr")); network.setsubnet(rs.getString("subnet")); network.setgateway(rs.getString("gateway")); network.setvlan_id((Integer) rs.getObject("vlan_id")); network.setstp(rs.getBoolean("stp")); network.setstorage_pool_id(NGuid.createGuidFromString(rs.getString("storage_pool_id"))); network.setMtu(rs.getInt("mtu")); network.setVmNetwork(rs.getBoolean("vm_network")); entity.setNetwork(network); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setCompatabilityVersion(new Version(rs.getString("compatibility_version"))); return entity; }

Target:
public NetworkView mapRow(ResultSet rs, int rowNum) throws SQLException { NetworkView entity = new NetworkView(); entity.setNetwork(NetworkRowMapper.instance.mapRow(rs, rowNum)); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setCompatabilityVersion(new Version(rs.getString("compatibility_version"))); return entity; }
Source:
public Client(String publicKey, String secretKey) throws ClientException { Preconditions.checkNotNull(secretKey); Config config = new Config(Endpoint.API_VERSION, publicKey, secretKey); httpClient = buildHttpClient(config); Serializer serializer = Serializer.defaultSerializer(); requester = new RequesterImpl(httpClient, serializer); balance = new BalanceResource(httpClient); charges = new ChargeResource(httpClient); customers = new CustomerResource(httpClient); disputes = new DisputeResource(httpClient); events = new EventResource(httpClient); forexes = new ForexResource(httpClient); links = new LinkResource(httpClient); occurrences = new OccurrenceResource(httpClient); receipts = new ReceiptResource(httpClient); recipients = new RecipientResource(httpClient); schedules = new ScheduleResource(httpClient); tokens = new TokenResource(httpClient); transactions = new TransactionResource(httpClient); transfers = new TransferResource(httpClient); sources = new SourceResource(httpClient); }

Target:
public Client(String publicKey, String secretKey) throws ClientException { Preconditions.checkNotNull(secretKey); Config config = new Config(Endpoint.API_VERSION, publicKey, secretKey); httpClient = buildHttpClient(config); Serializer serializer = Serializer.defaultSerializer(); requester = new RequesterImpl(httpClient, serializer); initResources(); }
Source:
public void addBuild(AbstractBuild<?, ?> build, PrintStream logger) { if (project == null) { project = build.getProject(); } loadPlotData(); for (Series series : getSeries()) { if (series == null) { continue; } List<PlotPoint> seriesData = series.loadSeries( build.getWorkspace(), build.getNumber(), logger); if (seriesData != null) { for (PlotPoint point : seriesData) { if (point == null) { continue; } rawPlotData.add(new String[] { point.getYvalue(), point.getLabel(), build.getNumber() + "", build.getTimestamp().getTimeInMillis() + "", point.getUrl() }); } } } savePlotData(); }

Target:
public void addBuild(AbstractBuild<?, ?> build, PrintStream logger) { addBuild(build, logger, build.getWorkspace()); }
Source:
public void fire(final Connection conn, final Object[] oldRow, final Object[] newRow) throws SQLException { final int updateCount; final int orgId = (int) (oldRow != null ? oldRow[_orgIndex] : newRow[_orgIndex]); Logger.info("Updating etag for organization " + orgId); try (final PreparedStatement stmt = conn.prepareStatement(_updateStatement)) { stmt.setInt(1, orgId); stmt.execute(); updateCount = stmt.getUpdateCount(); } if (updateCount == 0) { try (final PreparedStatement insert = conn.prepareStatement(_updateStatement)) { insert.setInt(1, orgId); insert.execute(); } } Logger.info("Done updating etag for organization " + orgId); }

Target:
public void fire(final Connection conn, final Object[] oldRow, final Object[] newRow) throws SQLException { final long orgId = (long) (oldRow != null ? oldRow[_orgIndex] : newRow[_orgIndex]); final Organization org = Organization.refById(orgId); _incrementEtag.accept(org); }
Source:
public List<NameKey> getParentCandidates() throws OrmException { final List<Project.NameKey> r = new ArrayList<Project.NameKey>(); for (final Project p : db.projects().getAllOrderedByParent()) { try { if (p.getParent() != null) { ProjectControl c = projectControlFactory.controlFor(p.getParent()); if (user.isAdministrator() || c.isVisible() || c.isOwner()) { if (!r.contains(p.getParent()) && !p.getParent().equals(wp)) { r.add(p.getParent()); } } } } catch (NoSuchProjectException e) { continue; } } return r; }

Target:
public List<NameKey> getParentCandidates() throws OrmException { final List<Project.NameKey> r = new ArrayList<Project.NameKey>(); for (final Project p : db.projects().getAllOrderedByParent()) { try { if (p.getParent() != null) { ProjectControl c = projectControlFactory.controlFor(p.getParent()); if (c.isVisible() || c.isOwner()) { if (!r.contains(p.getParent()) && !p.getParent().equals(wildProject)) { r.add(p.getParent()); } } } } catch (NoSuchProjectException e) { continue; } } return r; }
Source:
public void testHandleIoTune() { qos.setMaxThroughput(100); qos.setMaxIops(10000); VmInfoBuilder.handleIoTune(vmDevice, DISK_ID); Map<String, Long> ioTune = (Map<String, Long>) vmDevice.getSpecParams().get(VdsProperties.Iotune); assertIoTune(ioTune, 100L * 1024L * 1024L, 0, 0, 10000, 0, 0); }

Target:
public void testHandleIoTune() { qos.setMaxThroughput(100); qos.setMaxIops(10000); VmInfoBuilder.handleIoTune(vmDevice, DISK_ID); Map<String, Long> ioTune = (Map<String, Long>) vmDevice.getSpecParams().get(VdsProperties.Iotune); assertIoTune(ioTune, 100L * MB_TO_BYTES, 0, 0, 10000, 0, 0); }
Source:
public void deregisterSpecialPathInfo( SpecialPathInfo pathInfo, String pkgType ) { for ( Map.Entry<String, SpecialPathSet> entry : pkgtypes.entrySet() ) { if ( pkgType.equals( entry.getKey() ) ) { entry.getValue().deregisterSpecialPathInfo( pathInfo ); } } }

Target:
public void deregisterSpecialPathInfo( SpecialPathInfo pathInfo, String pkgType ) { pkgtypes.get(pkgType).deregisterSpecialPathInfo( pathInfo ); }
Source:
public Sequence selectInputSequence(SimpleList<Sequence> candidates) { double totalWeight = updateWeightMapForCandidates(candidates); Sequence selectedSequence = Randomness.randomMemberWeighted(candidates, weightMap, totalWeight); incrementCountInMap(sequenceSelectionCount, selectedSequence); return selectedSequence; }

Target:
public Sequence selectInputSequence(SimpleList<Sequence> candidates) { double totalWeight = computeTotalWeightForCandidates(candidates); Sequence selectedSequence = Randomness.randomMemberWeighted(candidates, weightMap, totalWeight); SequenceDetails sequenceDetails = sequenceDetailsMap.get(selectedSequence); sequenceDetails.incrementSelectionCount(); sequenceDetails.updateWeight(); weightMap.put(selectedSequence, sequenceDetails.getWeight()); return selectedSequence; }
Source:
public Response execute(ResourcePersistenceAPI api) throws Throwable; } private Response execute(Worker worker) throws WebApplicationException { ResourcePersistenceAPI api = null; try { api = persistenceFactory.getInstance(ZEN_CHART); return worker.execute(api); } catch (WebApplicationException w) { throw w; } catch (Throwable t) { throw new WebApplicationException(Utils.getErrorResponse( Utils.NOT_SPECIFIED, 500, "Exception while accessing resource", t.getMessage())); } finally { if (api != null) { persistenceFactory.returnInstance(api); } } }

Target:
public Response execute(ResourcePersistenceAPI api) throws Exception; } private Response execute(Worker worker) throws WebApplicationException { ResourcePersistenceAPI api = null; try { api = persistenceFactory.getInstance(ZEN_CHART); return worker.execute(api); } catch (WebApplicationException w) { throw w; } catch (Exception e) { throw new WebApplicationException(Utils.getErrorResponse( Utils.NOT_SPECIFIED, 500, "Exception while accessing resource", e.getMessage())); } finally { if (api != null) { persistenceFactory.returnInstance(api); } } }
Source:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type, LUNs lun, Guid storagePoolId) { if(storagePoolId == null || storagePoolId.equals(Guid.Empty)){ return new Pair<>(false, null); } if (FeatureSupported.refreshLunSupported(DbFacade.getInstance() .getStoragePoolDao() .get(storagePoolId) .getCompatibilityVersion())) { VDSReturnValue returnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.forValue(type), new StorageServerConnectionManagementVDSParameters(vdsId, storagePoolId, StorageType.FCP, Arrays.asList(getFCPConnection()))); boolean isSuccess = returnValue.getSucceeded(); EngineFault engineFault = null; if (!isSuccess && returnValue.getVdsError() != null) { engineFault = new EngineFault(); engineFault.setError(returnValue.getVdsError().getCode()); } return new Pair<>(isSuccess, engineFault); } else { return new Pair<>(true, null); } }

Target:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type, LUNs lun, Guid storagePoolId) { if (Guid.isNullOrEmpty(storagePoolId)) { return new Pair<>(true, null); } if (FeatureSupported.refreshLunSupported(DbFacade.getInstance() .getStoragePoolDao() .get(storagePoolId) .getCompatibilityVersion())) { VDSReturnValue returnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.forValue(type), new StorageServerConnectionManagementVDSParameters(vdsId, storagePoolId, StorageType.FCP, Arrays.asList(getFCPConnection()))); boolean isSuccess = returnValue.getSucceeded(); EngineFault engineFault = null; if (!isSuccess && returnValue.getVdsError() != null) { engineFault = new EngineFault(); engineFault.setError(returnValue.getVdsError().getCode()); } return new Pair<>(isSuccess, engineFault); } else { return new Pair<>(true, null); } }
Source:
private static ITmfTimeAligned getReferenceView(TmfTimeViewAlignmentInfo alignmentInfo, TmfView blackListedView) { IWorkbenchPage page = getWorkbenchWindow(alignmentInfo.getShell()).getActivePage(); int lowestTimeAxisOffset = Integer.MAX_VALUE; ITmfTimeAligned referenceView = null; for (IViewReference ref : page.getViewReferences()) { IViewPart view = ref.getView(false); if (view != blackListedView && view instanceof TmfView && view instanceof ITmfTimeAligned) { TmfView tmfView = (TmfView) view; ITmfTimeAligned alignedView = (ITmfTimeAligned) view; Composite parentComposite = tmfView.getParentComposite(); TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo(); if (parentComposite != null && parentComposite.isVisible() && timeViewAlignmentInfo != null && isViewLocationNear(alignmentInfo.getViewLocation(), getViewLocation(tmfView)) && alignedView.getAvailableWidth(timeViewAlignmentInfo.getTimeAxisOffset()) > 0 && timeViewAlignmentInfo.getTimeAxisOffset() < lowestTimeAxisOffset) { referenceView = (ITmfTimeAligned) view; lowestTimeAxisOffset = timeViewAlignmentInfo.getTimeAxisOffset(); break; } } } return referenceView; }

Target:
private static ITmfTimeAligned getReferenceView(TmfTimeViewAlignmentInfo alignmentInfo, TmfView blackListedView) { IWorkbenchPage page = getWorkbenchWindow(alignmentInfo.getShell()).getActivePage(); int lowestTimeAxisOffset = Integer.MAX_VALUE; ITmfTimeAligned referenceView = null; for (IViewReference ref : page.getViewReferences()) { IViewPart view = ref.getView(false); if (view != blackListedView && isTimeAlignedView(view)) { if (isCandidateForReferenceView((TmfView) view, alignmentInfo, lowestTimeAxisOffset)) { referenceView = (ITmfTimeAligned) view; lowestTimeAxisOffset = getClampedTimeAxisOffset(referenceView.getTimeViewAlignmentInfo()); break; } } } return referenceView; }
Source:
protected final Integer readVarInteger() throws IOException { long retvalue = 0; boolean is_negative = false; int b; done: for (;;) { if ((b = read()) < 0) throwUnexpectedEOFException(); if ((b & 0x40) != 0) { is_negative = true; } retvalue = (b & 0x3F); if ((b & 0x80) != 0) break done; if ((b = read()) < 0) throwUnexpectedEOFException(); retvalue = (retvalue << 7) | (b & 0x7F); if ((b & 0x80) != 0) break done; if ((b = read()) < 0) throwUnexpectedEOFException(); retvalue = (retvalue << 7) | (b & 0x7F); if ((b & 0x80) != 0) break done; if ((b = read()) < 0) throwUnexpectedEOFException(); retvalue = (retvalue << 7) | (b & 0x7F); if ((b & 0x80) != 0) break done; if ((b = read()) < 0) throwUnexpectedEOFException(); retvalue = (retvalue << 7) | (b & 0x7F); if ((b & 0x80) != 0) break done; throwVarIntOverflowException(); } if (is_negative) { retvalue = -retvalue; } int retValueAsInt = (int) retvalue; if(retvalue != ((long)retValueAsInt)) { throwVarIntOverflowException(); } if (is_negative && retValueAsInt == 0) { return null; } return retValueAsInt; }

Target:
protected final Integer readVarInteger() throws IOException { int firstByte = read(); if (firstByte == 0xC0) { return null; } return readVarInt(firstByte); }
Source:
private static void populateTestRegions() { Cache cache = CacheFactory.getAnyInstance(); Region<String, String> replicateRegion = cache.getRegion(REPLICATE_REGION_NAME); replicateRegion.put(EMPTY_STRING, "valueForEmptyKey"); replicateRegion.put("key1", "value1"); replicateRegion.put("key2", "value2"); Region<String, String> partitionedRegion = cache.getRegion(PARTITIONED_REGION_NAME); partitionedRegion.put("key1", "value1"); partitionedRegion.put("key2", "value2"); }

Target:
private static void populateTestRegions() { Cache cache = CacheFactory.getAnyInstance(); Region<String, String> replicateRegion = cache.getRegion(REPLICATE_REGION_NAME); replicateRegion.put(EMPTY_STRING, "valueForEmptyKey"); for (int i = 0; i < NUM_ENTRIES; i++) { replicateRegion.put("key" + i, "value" + i); } Region<String, String> partitionedRegion = cache.getRegion(PARTITIONED_REGION_NAME); replicateRegion.put(EMPTY_STRING, "valueForEmptyKey"); for (int i = 0; i < NUM_ENTRIES; i++) { partitionedRegion.put("key" + i, "value" + i); } }
Source:
private void applySeverityAndParamToChange(RuleActivation request, RuleActivatorContext context, ActiveRuleChange change) { String severity; if (request.isReset()) { severity = firstNonNull(context.parentSeverity(), context.defaultSeverity()); } else if (context.getRulesProfile().isBuiltIn()) { severity = firstNonNull(request.getSeverity(), context.defaultSeverity()); } else { severity = firstNonNull(request.getSeverity(), context.currentSeverity(), context.parentSeverity(), context.defaultSeverity()); } change.setSeverity(severity); for (RuleParamDto ruleParamDto : context.ruleParams()) { String paramKey = ruleParamDto.getName(); String paramValue; if (request.isReset()) { paramValue = firstNonNull(context.parentParamValue(paramKey), context.defaultParamValue(paramKey)); } else if (context.getRulesProfile().isBuiltIn()) { paramValue = firstNonNull(context.requestParamValue(request, paramKey), context.defaultParamValue(paramKey)); } else { paramValue = context.hasRequestParamValue(request, paramKey) ? firstNonNull( context.requestParamValue(request, paramKey), context.parentParamValue(paramKey), context.defaultParamValue(paramKey)) : firstNonNull( context.currentParamValue(paramKey), context.parentParamValue(paramKey), context.defaultParamValue(paramKey)); change.setParameter(paramKey, validateParam(ruleParamDto, paramValue)); } change.setParameter(paramKey, validateParam(ruleParamDto, firstNonNull(paramValue))); } }

Target:
private void applySeverityAndParamToChange(RuleActivation request, RuleActivatorContext context, ActiveRuleChange change) { String severity; if (request.isReset()) { severity = firstNonNull(context.parentSeverity(), context.defaultSeverity()); } else if (context.getRulesProfile().isBuiltIn()) { severity = firstNonNull(request.getSeverity(), context.defaultSeverity()); } else { severity = firstNonNull(request.getSeverity(), context.currentSeverity(), context.parentSeverity(), context.defaultSeverity()); } change.setSeverity(severity); for (RuleParamDto ruleParamDto : context.ruleParams()) { String paramKey = ruleParamDto.getName(); String paramValue; if (request.isReset()) { paramValue = firstNonNull(context.parentParamValue(paramKey), context.defaultParamValue(paramKey)); } else if (context.getRulesProfile().isBuiltIn()) { paramValue = firstNonNull(context.requestParamValue(request, paramKey), context.defaultParamValue(paramKey)); } else { paramValue = context.hasRequestParamValue(request, paramKey) ? firstNonNull( context.requestParamValue(request, paramKey), context.parentParamValue(paramKey), context.defaultParamValue(paramKey)) : firstNonNull( context.currentParamValue(paramKey), context.parentParamValue(paramKey), context.defaultParamValue(paramKey)); } change.setParameter(paramKey, validateParam(ruleParamDto, paramValue)); } }
Source:
private void setPlatformPropertiesToState(Dictionary<Object, Object> props) { Properties platformProperties = setDefaultPlatformProperties(); for (Enumeration<Object> enumeration = props.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); for (String PROPS1 : PROPS) { if (key.equals(PROPS1)) { platformProperties.put(key, props.get(key)); break; } } } platformProperties.put("osgi.resolver.usesMode", "ignore"); state.setPlatformProperties(platformProperties); }

Target:
private void setPlatformPropertiesToState(Dictionary<Object, Object> props) { Properties platformProperties = setDefaultPlatformProperties(); for (Enumeration<Object> enumeration = props.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); for (String property : PROPS) { if (key.equals(property)) { platformProperties.put(key, props.get(key)); break; } } } platformProperties.put("osgi.resolver.usesMode", "ignore"); state.setPlatformProperties(platformProperties); }
Source:
public void makeBucket(String bucketName, String region, boolean objectLock) throws InvalidBucketNameException, IllegalArgumentException, RegionConflictException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, XmlParserException, ErrorResponseException, InternalException, InvalidResponseException { if (region == null) { region = this.region; } if (this.region != null && !this.region.equals(region)) { throw new RegionConflictException( "passed region conflicts with the one previously specified"); } String configString = ""; if (region != null && !region.equals(US_EAST_1)) { CreateBucketConfiguration config = new CreateBucketConfiguration(region); configString = config.toString(); } Map<String, String> headerMap = null; if (objectLock) { headerMap = new HashMap<>(); headerMap.put("x-amz-bucket-object-lock-enabled", "true"); } Response response = executePut(bucketName, null, US_EAST_1, headerMap, null, configString, 0); response.body().close(); }

Target:
public void makeBucket(String bucketName, String region, boolean objectLock) throws InvalidBucketNameException, IllegalArgumentException, RegionConflictException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, XmlParserException, ErrorResponseException, InternalException, InvalidResponseException { if (region == null) { region = this.region; } if (this.region != null && !this.region.equals(region)) { throw new RegionConflictException( "passed region conflicts with the one previously specified"); } if (region == null) { region = US_EAST_1; } CreateBucketConfiguration config = null; if (!region.equals(US_EAST_1)) { config = new CreateBucketConfiguration(region); } Map<String, String> headerMap = null; if (objectLock) { headerMap = new HashMap<>(); headerMap.put("x-amz-bucket-object-lock-enabled", "true"); } Response response = executePut(bucketName, null, region, headerMap, null, config, 0); response.body().close(); }
Source:
public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(ac.getCloudContext(), stack); Boolean singleResourceGroup = azureResourceGroupMetadataProvider.useSingleResourceGroup(stack); if (singleResourceGroup) { List<CloudResource> cloudResourceList = collectResourcesToRemove(ac, stack, resources, azureUtils.getInstanceList(stack)); resources.addAll(cloudResourceList); azureTerminationHelperService.terminate(ac, stack, resources); return check(ac, Collections.emptyList()); } else { try { try { retryService.testWith2SecDelayMax5Times(() -> { if (!client.resourceGroupExists(resourceGroupName)) { throw new ActionFailedException("Resource group not exists"); } return true; }); client.deleteResourceGroup(resourceGroupName); } catch (ActionFailedException ignored) { LOGGER.debug("Resource group not found with name: {}", resourceGroupName); } } catch (CloudException e) { if (e.response().code() != AzureConstants.NOT_FOUND) { throw new CloudConnectorException(String.format("Could not delete resource group: %s", resourceGroupName), e); } else { return check(ac, Collections.emptyList()); } } return check(ac, resources); } }

Target:
public List<CloudResourceStatus> terminate(AuthenticatedContext ac, CloudStack stack, List<CloudResource> resources) { AzureClient client = ac.getParameter(AzureClient.class); String resourceGroupName = azureResourceGroupMetadataProvider.getResourceGroupName(ac.getCloudContext(), stack); Boolean singleResourceGroup = azureResourceGroupMetadataProvider.useSingleResourceGroup(stack); if (singleResourceGroup) { List<CloudResource> cloudResourceList = collectResourcesToRemove(ac, stack, resources, azureUtils.getInstanceList(stack)); resources.addAll(cloudResourceList); azureTerminationHelperService.terminate(ac, stack, resources); return check(ac, Collections.emptyList()); } else { try { try { azureUtils.checkResourceGroupExistence(client, resourceGroupName); client.deleteResourceGroup(resourceGroupName); } catch (ActionFailedException ignored) { LOGGER.debug("Resource group not found with name: {}", resourceGroupName); } } catch (CloudException e) { if (e.response().code() != AzureConstants.NOT_FOUND) { throw new CloudConnectorException(String.format("Could not delete resource group: %s", resourceGroupName), e); } else { return check(ac, Collections.emptyList()); } } return check(ac, resources); } }
Source:
public void handleNotification(PayaraNotification event) { if (session == null) { LOGGER.fine("Email notifier received notification, but no Java Mail session was available."); return; } final String message = event.getMessage(); final String subject = String.format("%s. (host: %s, server: %s, domain: %s, instance: %s)", event.getSubject(), event.getHostName(), event.getServerName(), event.getDomainName(), event.getInstanceName()); try { Message mime = new MimeMessage(session); mime.setRecipients(Message.RecipientType.TO, InternetAddress.parse(configuration.getRecipient())); mime.setSubject(subject); mime.setText(message); Transport.send(mime); LOGGER.log(Level.FINE, "Email successfully sent"); } catch (IllegalArgumentException e) { LOGGER.log(Level.SEVERE, "mail configuration properties are not provided carefully.", e); } catch (AuthenticationFailedException e) { LOGGER.log(Level.SEVERE, "Username and Password not accepted.", e); } catch (SendFailedException e) { LOGGER.log(Level.SEVERE, "Cannot send to specified recipient", e); } catch (MessagingException e) { LOGGER.log(Level.SEVERE, "Error occurred while trying to send mail.", e); } }

Target:
public void handleNotification(PayaraNotification event) { if (session == null) { LOGGER.fine("Email notifier received notification, but no Java Mail session was available."); return; } final String message = event.getMessage(); final String subject = String.format("%s. (host: %s, server: %s, domain: %s, instance: %s)", event.getSubject(), event.getHostName(), event.getServerName(), event.getDomainName(), event.getInstanceName()); try { Message mime = new MimeMessage(session); mime.setRecipients(Message.RecipientType.TO, InternetAddress.parse(configuration.getRecipient())); mime.setSubject(subject); mime.setText(message); Transport.send(mime); LOGGER.log(Level.FINE, "Email successfully sent"); } catch (IllegalArgumentException e) { LOGGER.log(Level.SEVERE, "Email configuration properties were not provided correctly.", e); } catch (AuthenticationFailedException e) { LOGGER.log(Level.SEVERE, "Username and Password not accepted.", e); } catch (SendFailedException e) { LOGGER.log(Level.SEVERE, "Cannot send to specified recipient", e); } catch (MessagingException e) { LOGGER.log(Level.SEVERE, "Error occurred while trying to send mail.", e); } }
Source:
public void kill(Process process) { if (C_LIBRARY != null) { killTree(getPid(process)); } else { throw new IllegalStateException("Cannot terminate process. Not a UNIX system?"); } }

Target:
public void kill(Process process) { if (C_LIBRARY != null) { killTree(getPid(process)); } else { throw new IllegalStateException("Cannot kill process. Not a UNIX system?"); } }
Source:
public void testDefaultAccessorCreateCustomData() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String path = String.format("/%s/%s", _rootPath, "msg_0"); ZkBaseDataAccessor defaultAccessor = new ZkBaseDataAccessor(ZK_ADDR); List<Integer> l0 = ImmutableList.of(1, 2, 3); boolean createResult = defaultAccessor.create(path, l0, AccessOption.PERSISTENT); Assert.assertFalse(createResult); createResult = defaultAccessor.create(path, new ZNRecord("test"), AccessOption.PERSISTENT); Assert.assertTrue(createResult); }

Target:
public void testDefaultAccessorCreateCustomData() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String path = String.format("/%s/%s", _rootPath, "msg_0"); ZkBaseDataAccessor defaultAccessor = new ZkBaseDataAccessor(ZK_ADDR); List<Integer> l0 = ImmutableList.of(1, 2, 3); boolean createResult = defaultAccessor.create(path, l0, AccessOption.PERSISTENT); Assert.assertFalse(createResult); createResult = defaultAccessor.create(path, new ZNRecord("test"), AccessOption.PERSISTENT); Assert.assertTrue(createResult); defaultAccessor.close(); System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); }
Source:
public LBClient(ILoadBalancer lb, IClientConfig clientConfig) { super(lb, clientConfig); this.setRetryHandler(RetryHandler.DEFAULT); this.clientConfig = clientConfig; connectTimeout = clientConfig.get(CommonClientConfigKey.ConnectTimeout); readTimeout = clientConfig.get(CommonClientConfigKey.ReadTimeout); }

Target:
LBClient(ILoadBalancer lb, IClientConfig clientConfig) { super(lb, clientConfig); this.setRetryHandler(RetryHandler.DEFAULT); this.clientConfig = clientConfig; connectTimeout = clientConfig.get(CommonClientConfigKey.ConnectTimeout); readTimeout = clientConfig.get(CommonClientConfigKey.ReadTimeout); }
Source:
public IPatient createPatient(int userID, String firstName, String lastName, String phoneNumber, Date birthday, String sex, String address, String city, Integer photoID) { if (userID < 0 || StringUtils.isNullOrWhiteSpace(firstName) || StringUtils.isNullOrWhiteSpace(lastName)) { return null; } IPatient patient = patientProvider.get(); patient.setUserId(userID); patient.setFirstName(firstName); patient.setLastName(lastName); patient.setPhoneNumber(phoneNumber); if (birthday != null) patient.setAge(birthday); patient.setSex(sex); patient.setAddress(address); patient.setCity(city); if (photoID != null) patient.setPhoto(Ebean.getReference(photoProvider.get().getClass(), photoID)); return patient; }

Target:
public IPatient createPatient(int userID, String firstName, String lastName, String phoneNumber, Date birthday, String sex, String address, String city, Integer photoID) { if (userID < 0 || StringUtils.isNullOrWhiteSpace(firstName) || StringUtils.isNullOrWhiteSpace(lastName)) { return null; } IPatient patient = patientProvider.get(); patient.setUserId(userID); patient.setFirstName(firstName); patient.setLastName(lastName); if (StringUtils.isNotNullOrWhiteSpace(phoneNumber)) patient.setPhoneNumber(phoneNumber); if (birthday != null) patient.setAge(birthday); patient.setSex(sex); patient.setAddress(address); patient.setCity(city); if (photoID != null) patient.setPhoto(Ebean.getReference(photoProvider.get().getClass(), photoID)); return patient; }
Source:
public static Map<String, Serializable> getFileMetadata( final Session session, final Serializable fileId ) throws ItemNotFoundException, RepositoryException { Map<String, Serializable> values = new HashMap<String, Serializable>(); String prefix = session.getNamespacePrefix( PentahoJcrConstants.PHO_NS ); Node fileNode; try { fileNode = session.getNodeByIdentifier( fileId.toString() ); } catch ( ItemNotFoundException e ) { return values; } PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session ); String metadataNodeName = pentahoJcrConstants.getPHO_METADATA(); Node metadataNode = null; try { metadataNode = NodeHelper.checkGetNode( fileNode, metadataNodeName ); } catch ( PathNotFoundException pathNotFound ) { return values; } PropertyIterator iter = metadataNode.getProperties( prefix + ":*" ); while ( iter.hasNext() ) { Property property = iter.nextProperty(); String key = property.getName().substring( property.getName().indexOf( ':' ) + 1 ); Serializable value = null; switch ( property.getType() ) { case PropertyType.STRING: value = property.getString(); break; case PropertyType.DATE: value = property.getDate(); break; case PropertyType.DOUBLE: value = property.getDouble(); break; case PropertyType.LONG: value = property.getLong(); break; case PropertyType.BOOLEAN: value = property.getBoolean(); break; } if ( value != null ) { values.put( key, value ); } } return values; }

Target:
public static Map<String, Serializable> getFileMetadata( final Session session, final Serializable fileId ) throws ItemNotFoundException, RepositoryException { Map<String, Serializable> values = new HashMap<String, Serializable>(); String prefix = session.getNamespacePrefix( PentahoJcrConstants.PHO_NS ); Node fileNode = session.getNodeByIdentifier( fileId.toString() ); PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session ); String metadataNodeName = pentahoJcrConstants.getPHO_METADATA(); Node metadataNode = null; try { metadataNode = NodeHelper.checkGetNode( fileNode, metadataNodeName ); } catch ( PathNotFoundException pathNotFound ) { return values; } PropertyIterator iter = metadataNode.getProperties( prefix + ":*" ); while ( iter.hasNext() ) { Property property = iter.nextProperty(); String key = property.getName().substring( property.getName().indexOf( ':' ) + 1 ); Serializable value = null; switch ( property.getType() ) { case PropertyType.STRING: value = property.getString(); break; case PropertyType.DATE: value = property.getDate(); break; case PropertyType.DOUBLE: value = property.getDouble(); break; case PropertyType.LONG: value = property.getLong(); break; case PropertyType.BOOLEAN: value = property.getBoolean(); break; } if ( value != null ) { values.put( key, value ); } } return values; }
Source:
public ResultSet executeCommand(String command) { openConnection(); ResultSet rs = null; try { rs = stat.executeQuery(command); } catch (SQLException e) { e.printStackTrace(); } closeConnection(); return rs; }

Target:
public ResultSet executeCommand(String command) { openConnection(); ResultSet resultSet = null; try { resultSet = statement.executeQuery(command); } catch (SQLException e) { e.printStackTrace(); } closeConnection(); return resultSet; }
Source:
public Token(Locator locator, String[] tokens, int level) { if (level > tokens.length - 1) throw new IllegalArgumentException("Invalid level for the given tokens"); this.locator = locator; this.token = tokens[level]; this.isLeaf = level == tokens.length - 1; String prefix = locator.getTenantId() + Token.SEPARATOR; this.parent = joinTokens("", "", tokens, level); String suffix = isLeaf ? LEAF_NODE_SUFFIX : ""; this.id = joinTokens(prefix, suffix, tokens, level + 1); }

Target:
public Token(Locator locator, String[] tokens, int level) { if (tokens == null || tokens.length <= 0) throw new IllegalArgumentException("Invalid tokens. Must be an array of size " + "greater than 0, representing tokens of a metric name."); if (level < 0 || level > tokens.length - 1) throw new IllegalArgumentException("Invalid level for the given tokens"); this.locator = locator; this.token = tokens[level]; this.isLeaf = level == tokens.length - 1; String prefix = locator.getTenantId() + Token.SEPARATOR; this.parent = joinTokens("", "", tokens, level); String suffix = isLeaf ? LEAF_NODE_SUFFIX : ""; this.id = joinTokens(prefix, suffix, tokens, level + 1); }