auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { logger.debug("Refreshing channel {}", channelUID); coapClient.asyncGet(this); return; } switch (channelUID.getId()) { case CHANNEL_BRIGHTNESS: if (command instanceof PercentType) { setBrightness((PercentType) command); } else if (command instanceof OnOffType) { setState(((OnOffType) command)); } else if (command instanceof IncreaseDecreaseType) { if (state != null) { int current = state.getBrightness().intValue(); if (IncreaseDecreaseType.INCREASE.equals(command)) { setBrightness(new PercentType(Math.min(current + STEP, PercentType.HUNDRED.intValue()))); } else { setBrightness(new PercentType(Math.max(current - STEP, PercentType.ZERO.intValue()))); } } else { logger.debug("Cannot handle inc/dec as current state is not known."); } } else { logger.debug("Cannot handle command for channel {}", command, channelUID); } break; case CHANNEL_COLOR_TEMPERATURE: if (command instanceof PercentType) { setColorTemperature((PercentType) command); } else if (command instanceof IncreaseDecreaseType) { if (state != null) { int current = state.getColorTemperature().intValue(); if (IncreaseDecreaseType.INCREASE.equals(command)) { setColorTemperature( new PercentType(Math.min(current + STEP, PercentType.HUNDRED.intValue()))); } else { setColorTemperature(new PercentType(Math.max(current - STEP, PercentType.ZERO.intValue()))); } } else { logger.debug("Cannot handle inc/dec as current state is not known."); } } else { logger.debug("Can't handle command on channel {}", command, channelUID); } break; default: logger.error("Unknown channel UID {}", channelUID); } }

Target:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { logger.debug("Refreshing channel {}", channelUID); coapClient.asyncGet(this); return; } switch (channelUID.getId()) { case CHANNEL_BRIGHTNESS: handleBrightnessCommand(command); break; case CHANNEL_COLOR_TEMPERATURE: handleColorTemperatureCommand(command); break; default: logger.error("Unknown channel UID {}", channelUID); } }
Source:
public ScmArtifact getArtifact(IResource resource, String revision) { ISVNRemoteResource svnResource = null; SubclipseRepository repo = null; ISVNRemoteResource remoteResource = null; try { svnResource = SVNWorkspaceRoot.getBaseResourceFor(resource); if (svnResource == null) { return null; } SVNRevision svnRevision = new SVNRevision.Number(Long.parseLong(revision)); GetLogsCommand logCmd = new GetLogsCommand(svnResource, null, svnRevision, svnRevision, false, 1L, null, true); try { logCmd.run(new NullProgressMonitor()); } catch (SVNException e) { return null; } final ILogEntry[] entries = logCmd.getLogEntries(); if (entries.length < 1) { return null; } remoteResource = entries[entries.length - 1].getRemoteResource(); if (null == remoteResource) { return null; } repo = (SubclipseRepository) getRepository(resource, null); } catch (SVNException e) { return null; } catch (CoreException e) { return null; } String id = Long.toString(remoteResource.getLastChangedRevision().getNumber()); SubclipseArtifact artifact = new SubclipseArtifact(id, remoteResource.getRepositoryRelativePath(), repo); artifact.setProjectName(resource.getProject().getName()); artifact.setProjectRelativePath(resource.getProjectRelativePath().toPortableString()); artifact.setRemoteResource(remoteResource); return artifact; }

Target:
public ScmArtifact getArtifact(IResource resource, String revision) { ISVNRemoteResource localResource = null; SubclipseRepository repo = null; ISVNRemoteResource resolvedResource = null; try { localResource = SVNWorkspaceRoot.getBaseResourceFor(resource); if (null == revision) { resolvedResource = localResource; } else { SVNRevision svnRevision = new SVNRevision.Number(Long.parseLong(revision)); GetLogsCommand logCmd = new GetLogsCommand(localResource, null, svnRevision, svnRevision, false, 1L, null, true); try { logCmd.run(new NullProgressMonitor()); } catch (SVNException e) { return null; } final ILogEntry[] entries = logCmd.getLogEntries(); if (entries.length < 1) { return null; } resolvedResource = entries[entries.length - 1].getRemoteResource(); } if (null == resolvedResource) { return null; } repo = (SubclipseRepository) getRepository(resource, null); } catch (SVNException e) { return null; } catch (CoreException e) { return null; } String id = Long.toString(resolvedResource.getLastChangedRevision().getNumber()); SubclipseArtifact artifact = new SubclipseArtifact(id, resolvedResource.getRepositoryRelativePath(), repo); artifact.setProjectName(resource.getProject().getName()); artifact.setProjectRelativePath(resource.getProjectRelativePath().toPortableString()); artifact.setRemoteResource(resolvedResource); return artifact; }
Source:
private boolean checkSupportedAudio() { try { AudioHeader header = audioFile.getAudioHeader(); bitrate = header.getBitRateAsNumber(); sampleRate = header.getSampleRateAsNumber(); channels = header.getChannels(); if (header.getChannels().toLowerCase().contains("stereo")) { channels = "2"; } length = header.getTrackLength(); Tag tag = audioFile.getTag(); artist = tag.getFirst(FieldKey.ARTIST); album = tag.getFirst(FieldKey.ALBUM); title = tag.getFirst(FieldKey.TITLE); comment = tag.getFirst(FieldKey.COMMENT); year = tag.getFirst(FieldKey.YEAR); track = tag.getFirst(FieldKey.TRACK); genre = tag.getFirst(FieldKey.GENRE); artwork = new ArrayList<AudioMetadataArtwork>(); for (Artwork a : tag.getArtworkList()) { AudioMetadataArtwork ama = new AudioMetadataArtwork(); ama.setMimeType(a.getMimeType()); if (a.getPictureType() >= 0) { ama.setType(a.getPictureType()); } ama.setData(a.getBinaryData()); artwork.add(ama); } return true; } catch (Exception e) { e.printStackTrace(); } return false; }

Target:
private boolean checkSupportedAudio() { AudioHeader header = audioFile.getAudioHeader(); bitrate = header.getBitRateAsNumber(); sampleRate = header.getSampleRateAsNumber(); channels = header.getChannels(); if (header.getChannels().toLowerCase().contains("stereo")) { channels = "2"; } if (header instanceof MP3AudioHeader) { duration = ((MP3AudioHeader) header).getPreciseTrackLength(); } else if (header instanceof Mp4AudioHeader) { duration = new Double(((Mp4AudioHeader) header).getPreciseLength()); } else { duration = new Double((double) header.getTrackLength()); } Tag tag = audioFile.getTag(); artist = tag.getFirst(FieldKey.ARTIST); album = tag.getFirst(FieldKey.ALBUM); title = tag.getFirst(FieldKey.TITLE); comment = tag.getFirst(FieldKey.COMMENT); year = tag.getFirst(FieldKey.YEAR); track = tag.getFirst(FieldKey.TRACK); genre = tag.getFirst(FieldKey.GENRE); artwork = new ArrayList<AudioMetadataArtwork>(); for (Artwork a : tag.getArtworkList()) { AudioMetadataArtwork ama = new AudioMetadataArtwork(); ama.setMimeType(a.getMimeType()); if (a.getPictureType() >= 0) { ama.setType(a.getPictureType()); } ama.setData(a.getBinaryData()); artwork.add(ama); } return true; }
Source:
public static Double stSphericalLength(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return null; } validateSphericalType("ST_Length", geometry, EnumSet.of(LINE_STRING)); OGCLineString lineString = (OGCLineString) geometry; return IntStream.range(0, lineString.numPoints() - 1) .mapToDouble(n -> { OGCPoint p1 = lineString.pointN(n); OGCPoint p2 = lineString.pointN(n + 1); return greatCircleDistance(p1.Y(), p1.X(), p2.Y(), p2.X()) * 1000; }) .sum(); }

Target:
public static Double stSphericalLength(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return null; } validateSphericalType("ST_Length", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING)); MultiPath lineString = (MultiPath) geometry.getEsriGeometry(); double sum = 0; for (int path = 0; path < lineString.getPathCount(); path++) { if (lineString.getPathSize(path) < 2) { continue; } int pathStart = lineString.getPathStart(path); Point prev = lineString.getPoint(pathStart); for (int i = pathStart + 1; i < lineString.getPathEnd(path); i++) { Point next = lineString.getPoint(i); sum += greatCircleDistance(prev.getY(), prev.getX(), next.getY(), next.getX()); prev = next; } } return sum * 1000; }
Source:
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { drawBackground(BACKGROUND); super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); fuelInfo = furnace.getFuelDisplay(); this.mc.getTextureManager().bindTexture(BACKGROUND); float fuel = furnace.getFuelPercentage(); if(fuel > 0) { GuiElement flame = this.flame; int height = 1 + Math.round(fuel * (flame.h - 1)); int x = 26 + cornerX; int y = 41 + cornerY + flame.h - height; GuiScreen.drawModalRectWithCustomSizedTexture(x, y, flame.x, flame.y + flame.h - height, flame.w, height, flame.texW, flame.texH); } if(fuelInfo.fluid != null && fuelInfo.fluid.amount > 0) { int x = 71 + cornerX; int y = 16 + cornerY + 52; int w = 12; int h = (int) (52f * fuelInfo.fluid.amount / fuelInfo.maxCap); RenderUtil.renderTiledFluid(x, y - h, w, h, this.zLevel, fuelInfo.fluid); } }

Target:
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { drawBackground(BACKGROUND); super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); this.mc.getTextureManager().bindTexture(BACKGROUND); float fuel = furnace.getFuelPercentage(); if(fuel > 0) { GuiElement flame = this.flame; int height = 1 + Math.round(fuel * (flame.h - 1)); int x = 26 + cornerX; int y = 41 + cornerY + flame.h - height; GuiScreen.drawModalRectWithCustomSizedTexture(x, y, flame.x, flame.y + flame.h - height, flame.w, height, flame.texW, flame.texH); } fuelInfo = furnace.getFuelDisplay(); drawFuel(71, 16, 12, 52); }
Source:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length != 2 && words.length != 3) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!isBase64(words[1].getBytes())) { return false; } return true; }

Target:
public static boolean isPublicKeyValid(String publicKey) { String[] words = publicKey.split("\\s+", 3); if (words.length < 2) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!isBase64(words[1].getBytes())) { return false; } return true; }
Source:
public Object evaluate(Object feature) { String format; Double number; String localeString = ""; try { format = getExpression(0).evaluate(feature, String.class); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function NumberFormat argument #0 - expected type String"); } try { number = getExpression(1).evaluate(feature, Double.class); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function NumberFormat argument #1 - expected type java.util.Double"); } if (format == null || number == null) { return null; } try { if (params.size() > 2) { Expression second = getExpression(2); localeString = second.evaluate(feature, String.class); } } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function NumberFormat argument #2 - expected type String"); } if (localeString != null && !localeString.isEmpty() && languages.contains(localeString)) { locale = Locale.forLanguageTag(localeString); } DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(locale); DecimalFormat numberFormat = new DecimalFormat(format, decimalFormatSymbols); return numberFormat.format(number); }

Target:
public Object evaluate(Object feature) { String format; Double number; String localeString = ""; try { format = getExpression(0).evaluate(feature, String.class); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function NumberFormat argument #0 - expected type String"); } try { number = getExpression(1).evaluate(feature, Double.class); } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function NumberFormat argument #1 - expected type java.util.Double"); } if (format == null || number == null) { return null; } try { if (params.size() > 2) { Expression second = getExpression(2); localeString = second.evaluate(feature, String.class); } } catch (Exception e) { throw new IllegalArgumentException( "Filter Function problem for function NumberFormat argument #2 - expected type String"); } if (languages.contains(localeString)) { if (localeString != null && !localeString.isEmpty()) { locale = Locale.forLanguageTag(localeString); } } else { throw new IllegalArgumentException( "Unknown language code '" + localeString + "' in numberFormat function"); } DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(locale); DecimalFormat numberFormat = new DecimalFormat(format, decimalFormatSymbols); return numberFormat.format(number); }
Source:
private PinotExpression handleLogicalBinary(String operator, CallExpression call, Function<VariableReferenceExpression, Selection> context) { if (!LOGICAL_BINARY_OPS_FILTER.contains(operator)) { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("'%s' is not supported in filter", operator)); } List<RowExpression> arguments = call.getArguments(); if (arguments.size() == 2) { return derived(format("(%s %s %s)", arguments.get(0).accept(this, context).getDefinition(), operator, arguments.get(1).accept(this, context).getDefinition())); } else { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("Unknown logical binary: '%s'", call)); } }

Target:
private PinotExpression handleLogicalBinary( String operator, CallExpression call, Function<VariableReferenceExpression, Selection> context) { if (!LOGICAL_BINARY_OPS_FILTER.contains(operator)) { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("'%s' is not supported in filter", operator)); } List<RowExpression> arguments = call.getArguments(); if (arguments.size() == 2) { return derived(format( "(%s %s %s)", arguments.get(0).accept(this, context).getDefinition(), operator, arguments.get(1).accept(this, context).getDefinition())); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("Unknown logical binary: '%s'", call)); }
Source:
@Override public void onPartitionCreated(int grpId, int partId) throws IgniteCheckedException { PageStore store = getStore(grpId, partId); if (store instanceof FilePageStore) ((FilePageStore)store).dereferenceFile(); }

Target:
@Override public void onPartitionCreated(int grpId, int partId) { }
Source:
protected Control createDialogArea(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 9; layout.marginWidth = 9; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); final Label label = new Label(container, SWT.NULL); String labelText = "New representation name ("; if (isCaseSensitive) { labelText += "case sensitive"; } else { labelText += "case insensitive"; } labelText += "):"; label.setText(labelText); text = new Text(container, SWT.SINGLE | SWT.BORDER); text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { textChanged(text.getText()); } }); gd = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(gd); Dialog.applyDialogFont(container); return container; }

Target:
protected Control createDialogArea(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginHeight = 9; layout.marginWidth = 9; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); container.setLayoutData(gd); final Label label = new Label(container, SWT.NULL); String labelText; if (getMessage() != null && getMessage().length() > 0) { labelText = getMessage(); } else { labelText = "Enter new name ("; if (isCaseSensitive) { labelText += "case sensitive"; } else { labelText += "case insensitive"; } labelText += "):"; } label.setText(labelText); text = new Text(container, SWT.SINGLE | SWT.BORDER); if (newName != null) { text.setText(newName); } else { text.setText(oldName); } text.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { textChanged(text.getText()); } }); gd = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(gd); Dialog.applyDialogFont(container); return container; }
Source:
public StreamingOutput setSolr(@PathParam("command") final String command, @Context UriInfo uriInfo) throws JsonGenerationException, JsonMappingException, IOException { if (!"select".equals(command)) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("command not supported").build()); } String query = uriInfo.getRequestUri().getRawQuery(); if (null == query) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("invalid query").build()); } ResultsWrapper results; try { results = searchService.select(query); return new StringStreamingOutput(results); } catch (Exception e) { log.error(e.getMessage()); throw new WebApplicationException(Response.serverError().entity("Search not currently available.").build()); } }

Target:
public StreamingOutput setSolr(@PathParam("command") final String command, @Context UriInfo uriInfo) throws JsonGenerationException, JsonMappingException, IOException { if (!"select".equals(command)) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("command not supported").build()); } String query = uriInfo.getRequestUri().getRawQuery(); if (null == query) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("invalid query").build()); } ResultsWrapper results; try { results = searchService.select(query); return new StringStreamingOutput(results); } catch (IOException e) { log.error(e.getMessage(), e); throw new WebApplicationException(Response.serverError().entity("Search not currently available.").build()); } }
Source:
private Page createFragmentsPage() { Collection<Slice> fragments = getFutureValue(finishFuture); committed = true; updateWrittenBytes(); PageBuilder page = new PageBuilder(fragments.size() + 2, ImmutableList.of(types.get(ROW_COUNT_CHANNEL), types.get(FRAGMENT_CHANNEL), types.get(CONTEXT_CHANNEL))); BlockBuilder rowsBuilder = page.getBlockBuilder(0); BlockBuilder fragmentBuilder = page.getBlockBuilder(1); BlockBuilder operatorExecutionContextBuilder = page.getBlockBuilder(2); TaskId taskId = operatorContext.getDriverContext().getPipelineContext().getTaskId(); Slice operatorExecutionContext = wrappedBuffer(operatorExecutionContextCodec.toJsonBytes(new OperatorExecutionContext(operatorContext.getDriverContext().getLifespan(), taskId.getStageId().getId(), taskId.getId(), CommitGranularity.TABLE, true))); page.declarePosition(); BIGINT.writeLong(rowsBuilder, rowCount); fragmentBuilder.appendNull(); VARBINARY.writeSlice(operatorExecutionContextBuilder, operatorExecutionContext); for (Slice fragment : fragments) { page.declarePosition(); rowsBuilder.appendNull(); VARBINARY.writeSlice(fragmentBuilder, fragment); VARBINARY.writeSlice(operatorExecutionContextBuilder, operatorExecutionContext); } return page.build(); }

Target:
private Page createFragmentsPage() { Collection<Slice> fragments = getFutureValue(finishFuture); int positionCount = fragments.size() + 1; committed = true; updateWrittenBytes(); BlockBuilder rowsBuilder = BIGINT.createBlockBuilder(null, positionCount); BlockBuilder fragmentBuilder = VARBINARY.createBlockBuilder(null, positionCount); BIGINT.writeLong(rowsBuilder, rowCount); fragmentBuilder.appendNull(); for (Slice fragment : fragments) { rowsBuilder.appendNull(); VARBINARY.writeSlice(fragmentBuilder, fragment); } return new Page(positionCount, rowsBuilder.build(), fragmentBuilder.build(), RunLengthEncodedBlock.create(VARBINARY, getTableCommitContext(true), positionCount)); }
Source:
@Override public boolean shouldShow() { return super.shouldShow() && DeviceUtil.isOnline() && !OfflineManager.hasCompilation(); }

Target:
@Override public boolean shouldShow() { return super.shouldShow() && ReleaseUtil.isPreBetaRelease() && DeviceUtil.isOnline() && !OfflineManager.hasCompilation(); }
Source:
public Proxy getProxy() { if (mProxyHost == null) return null; Proxy.Type type = null; switch (mProxyType) { case TYPE_HTTP: type = Proxy.Type.HTTP; break; case TYPE_SOCKS: type = Proxy.Type.SOCKS; break; } return new Proxy(type, new InetSocketAddress(mProxyHost, mProxyPort)); }

Target:
public Proxy getProxy() { if (mProxyHost == null) { return null; } return new Proxy(mProxyType, new InetSocketAddress(mProxyHost, mProxyPort)); }
Source:
protected void executeVmCommand() { final Snapshot activeSnapshot = getSnapshotDao().get(getVmId(), SnapshotType.ACTIVE); final Guid createdSnapshotId = activeSnapshot.getId(); getParameters().setSnapshotType(determineSnapshotType()); TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Void>() { @Override public Void runInTransaction() { getSnapshotDao().updateId(createdSnapshotId, newActiveSnapshotId); getCompensationContext().snapshotEntity(activeSnapshot); activeSnapshot.setId(newActiveSnapshotId); getCompensationContext().snapshotNewEntity(activeSnapshot); getCompensationContext().stateChanged(); return null; } }); setActionReturnValue(createdSnapshotId); MemoryImageBuilder memoryImageBuilder = getMemoryImageBuilder(); freezeVm(); createSnapshotsForDisks(); addSnapshotToDB(createdSnapshotId, memoryImageBuilder); fastForwardDisksToActiveSnapshot(); memoryImageBuilder.build(); boolean pendingAsyncTasks = !getTaskIdList().isEmpty() || !CommandCoordinatorUtil.getChildCommandIds(getCommandId()).isEmpty(); if (!pendingAsyncTasks) { getParameters().setTaskGroupSuccess(true); incrementVmGeneration(); } setSucceeded(true); }

Target:
protected void executeVmCommand() { getParameters().setSnapshotType(determineSnapshotType()); Snapshot activeSnapshot = getSnapshotDao().get(getVmId(), SnapshotType.ACTIVE); Guid createdSnapshotId = activeSnapshot.getId(); updateActiveSnapshotId(activeSnapshot); setActionReturnValue(createdSnapshotId); MemoryImageBuilder memoryImageBuilder = getMemoryImageBuilder(); freezeVm(); createSnapshotsForDisks(); addSnapshotToDB(createdSnapshotId, memoryImageBuilder); fastForwardDisksToActiveSnapshot(); memoryImageBuilder.build(); boolean pendingAsyncTasks = !getTaskIdList().isEmpty() || !CommandCoordinatorUtil.getChildCommandIds(getCommandId()).isEmpty(); if (!pendingAsyncTasks) { getParameters().setTaskGroupSuccess(true); incrementVmGeneration(); } setSucceeded(true); }
Source:
public Vm update(Vm incoming) { validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); if(!clusterId.toString().equals(get().getCluster().getId())){ performAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(clusterId, guid, null)); } } if (!isFiltered()) { if (incoming.isSetPlacementPolicy()) { parent.validateAndUpdateHostsInPlacementPolicy(incoming.getPlacementPolicy()); } } else { incoming.setPlacementPolicy(null); } Vm vm = performUpdate( incoming, new QueryIdResolver<>(VdcQueryType.GetVmNextRunConfiguration, IdQueryParameters.class), VdcActionType.UpdateVm, new UpdateParametersProvider() ); if (vm != null) { DisplayHelper.adjustDisplayData(this, vm, false); removeRestrictedInfo(vm); } return vm; }

Target:
public Vm update(Vm incoming) { validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); if(!clusterId.toString().equals(get().getCluster().getId())){ performAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(clusterId, guid, null)); } } if (!isFiltered()) { if (incoming.isSetPlacementPolicy()) { parent.validateAndUpdateHostsInPlacementPolicy(incoming.getPlacementPolicy()); } } else { incoming.setPlacementPolicy(null); } VdcQueryType queryType = isNextRunRequested() ? VdcQueryType.GetVmNextRunConfiguration : VdcQueryType.GetVmByVmId; Vm vm = performUpdate( incoming, new QueryIdResolver<>(queryType, IdQueryParameters.class), VdcActionType.UpdateVm, new UpdateParametersProvider() ); if (vm != null) { DisplayHelper.adjustDisplayData(this, vm, false); removeRestrictedInfo(vm); } return vm; }
Source:
public static String decapitalize(String string) { if ( string == null || string.isEmpty() || startsWithSeveralUpperCaseLetters( string ) ) { return string; } else { return string.substring( 0, 1 ).toLowerCase( Locale.ENGLISH ) + string.substring( 1 ); } }

Target:
public static String decapitalize(String string) { if ( string == null || string.isEmpty() || startsWithSeveralUpperCaseLetters( string ) ) { return string; } else { return string.substring( 0, 1 ).toLowerCase( Locale.ROOT ) + string.substring( 1 ); } }
Source:
public void scanFile(JavaFileScannerContext context) { expectedLevel = 0; isBlockAlreadyReported = false; lastCheckedLine = 0; isInAnonymousClass.clear(); this.context = context; scan(context.getTree()); isInAnonymousClass.clear(); }

Target:
public void scanFile(JavaFileScannerContext context) { expectedLevel = 0; isBlockAlreadyReported = false; lastCheckedLine = 0; this.context = context; scan(context.getTree()); isInAnonymousClass.clear(); }
Source:
public void testZeroExecutorScheduling() { ConstraintSolverStrategy cs = new ConstraintSolverStrategy(); cs.prepare(new HashMap<>()); Map<String, Object> topoConf = Utils.readDefaultConfig(); topoConf.put(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH, 1_000); topoConf.put(Config.TOPOLOGY_RAS_ONE_EXECUTOR_PER_WORKER, false); topoConf.put(Config.TOPOLOGY_RAS_ONE_COMPONENT_PER_WORKER, false); TopologyDetails topo = makeTopology(topoConf, 1); Cluster cluster = makeCluster(new Topologies(topo)); cs.schedule(cluster, topo); LOG.info("********************* Scheduling Zero Unassigned Executors *********************"); cs.schedule(cluster, topo); LOG.info("********************* End of Scheduling Zero Unassigned Executors *********************"); }

Target:
public void testZeroExecutorScheduling() { ConstraintSolverStrategy cs = new ConstraintSolverStrategy(); cs.prepare(new HashMap<>()); Map<String, Object> topoConf = new HashMap<>(); topoConf.put(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH, 1_000); topoConf.put(Config.TOPOLOGY_RAS_ONE_EXECUTOR_PER_WORKER, false); topoConf.put(Config.TOPOLOGY_RAS_ONE_COMPONENT_PER_WORKER, false); TopologyDetails topo = makeTopology(topoConf, 1); Cluster cluster = makeCluster(new Topologies(topo)); cs.schedule(cluster, topo); LOG.info("********************* Scheduling Zero Unassigned Executors *********************"); cs.schedule(cluster, topo); LOG.info("********************* End of Scheduling Zero Unassigned Executors *********************"); }
Source:
public void start() { queryManagementExecutor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { try { failAbandonedQueries(); } catch (Throwable e) { log.warn(e, "Error cancelling abandoned queries"); } try { enforceMemoryLimits(); } catch (Throwable e) { log.warn(e, "Error enforcing memory limits"); } try { enforceTimeLimits(); } catch (Throwable e) { log.warn(e, "Error enforcing query timeout limits"); } try { enforceCpuLimits(); } catch (Throwable e) { log.warn(e, "Error enforcing query CPU time limits"); } try { removeExpiredQueries(); } catch (Throwable e) { log.warn(e, "Error removing expired queries"); } try { pruneExpiredQueries(); } catch (Throwable e) { log.warn(e, "Error pruning expired queries"); } } }, 1, 1, TimeUnit.SECONDS); }

Target:
public void start() { queryManagementExecutor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { try { failAbandonedQueries(); } catch (Throwable e) { log.error(e, "Error cancelling abandoned queries"); } try { enforceMemoryLimits(); } catch (Throwable e) { log.error(e, "Error enforcing memory limits"); } try { enforceTimeLimits(); } catch (Throwable e) { log.error(e, "Error enforcing query timeout limits"); } try { enforceCpuLimits(); } catch (Throwable e) { log.error(e, "Error enforcing query CPU time limits"); } try { removeExpiredQueries(); } catch (Throwable e) { log.error(e, "Error removing expired queries"); } try { pruneExpiredQueries(); } catch (Throwable e) { log.error(e, "Error pruning expired queries"); } } }, 1, 1, TimeUnit.SECONDS); }
Source:
protected void setSecondsLabel(View view, BrickField brickField) { TextView textView = view.findViewById(R.id.brick_seconds_label); Context context = textView.getContext(); if (getFormulaWithBrickField(brickField).isSingleNumberFormula()) { try { Double formulaValue = formulaMap.get(brickField) .interpretDouble(ProjectManager.getInstance().getCurrentSprite()); textView.setText(context.getResources().getQuantityString(R.plurals.second_plural, Utils.convertDoubleToPluralInteger(formulaValue))); } catch (InterpretationException e) { Log.e(getClass().getSimpleName(), "Interpretation of formula failed, fallback to quantity \"other\"", e); } return; } textView.setText(context.getResources() .getQuantityString(R.plurals.second_plural, Utils.TRANSLATION_PLURAL_OTHER_INTEGER)); }

Target:
protected void setSecondsLabel(View view, BrickField brickField) { TextView textView = view.findViewById(R.id.brick_seconds_label); Context context = textView.getContext(); if (getFormulaWithBrickField(brickField).isSingleNumberFormula()) { try { Sprite sprite = ProjectManager.getInstance().getCurrentSprite(); Double formulaValue = formulaMap.get(brickField).interpretDouble(sprite); textView.setText(context.getResources().getQuantityString(R.plurals.second_plural, Utils.convertDoubleToPluralInteger(formulaValue))); return; } catch (InterpretationException e) { Log.e(getClass().getSimpleName(), "Interpretation of formula failed, " + "fallback to quantity \"other\" for \"second(s)\" label.", e); } } textView.setText(context.getResources() .getQuantityString(R.plurals.second_plural, Utils.TRANSLATION_PLURAL_OTHER_INTEGER)); }
Source:
public void makesXslTransformationsInThreads() throws Exception { final int zero = 0; final int fifty = 50; final int ten = 10; final XSL xsl = new XSLDocument( StringUtils.join( "<xsl:stylesheet ", " xmlns:xsl='<LINK_0>' ", " version='2.0' >", "<xsl:template match='/'><works/>", "</xsl:template> </xsl:stylesheet>" ) ); final Runnable runnable = new Runnable() { @Override public void run() { MatcherAssert.assertThat( xsl.transform(new XMLDocument("<test/>")), XhtmlMatchers.hasXPath("/works") ); } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = zero; count < fifty; count = count + 1) { executorService.submit(runnable); } executorService.awaitTermination(ten, TimeUnit.SECONDS); executorService.shutdown(); }

Target:
public void makesXslTransformationsInThreads() throws Exception { final int loop = 50; final int timeout = 30; final XSL xsl = new XSLDocument( StringUtils.join( "<xsl:stylesheet ", " xmlns:xsl='<LINK_0>' ", " version='2.0' >", "<xsl:template match='/'><works/>", "</xsl:template> </xsl:stylesheet>" ) ); final Runnable runnable = new Runnable() { @Override public void run() { MatcherAssert.assertThat( xsl.transform(new XMLDocument("<test/>")), XhtmlMatchers.hasXPath("/works") ); } }; final ExecutorService executorService = Executors.newFixedThreadPool(5); for (int count = 0; count < loop; count = count + 1) { executorService.submit(runnable); } executorService.shutdown(); MatcherAssert.assertThat( executorService.awaitTermination(timeout, TimeUnit.SECONDS), Matchers.is(true) ); executorService.shutdownNow(); }
Source:
public static Binary fromByteBuffer( final ByteBuffer value, final int offset, final int length) { return new Binary() { @Override public String toStringUsingUTF8() { return new String(getBytes(), BytesUtils.UTF8); } @Override public int length() { return length; } @Override public void writeTo(OutputStream out) throws IOException { out.write(getBytes()); } @Override public byte[] getBytes() { byte[] bytes = new byte[length]; value.mark(); value.position(offset); value.get(bytes).reset(); return bytes; } @Override public int hashCode() { byte[] bytes = getBytes(); return Binary.hashCode(bytes, 0, bytes.length); } @Override boolean equals(Binary other) { byte[] bytes = getBytes(); return other.equals(bytes, 0, bytes.length); } @Override boolean equals(byte[] other, int otherOffset, int otherLength) { byte[] bytes = getBytes(); return Binary.equals(bytes, 0, bytes.length, other, otherOffset, otherLength); } @Override public int compareTo(Binary other) { byte[] bytes = getBytes(); return other.compareTo(bytes, 0, bytes.length); } @Override int compareTo(byte[] other, int otherOffset, int otherLength) { byte[] bytes = getBytes(); return Binary.compareTwoByteArrays(bytes, 0, bytes.length, other, otherOffset, otherLength); } @Override public ByteBuffer toByteBuffer() { ByteBuffer buf; value.mark(); value.position(offset); buf = value.slice(); buf.limit(length); value.reset(); return buf; } @Override public void writeTo(DataOutput out) throws IOException { for (int i = offset; i < offset + length; i++) { out.write(value.get(i)); } } }; }

Target:
public static Binary fromByteBuffer( final ByteBuffer value, final int offset, final int length) { return new Binary() { @Override public String toStringUsingUTF8() { return new String(getBytes(), BytesUtils.UTF8); } @Override public int length() { return length; } @Override public void writeTo(OutputStream out) throws IOException { out.write(getBytes()); } @Override public byte[] getBytes() { byte[] bytes = new byte[length]; ByteBuffer temp; temp = value.duplicate(); temp.position(offset); temp.get(bytes); return bytes; } @Override public int hashCode() { byte[] bytes = getBytes(); return Binary.hashCode(bytes, 0, bytes.length); } @Override boolean equals(Binary other) { if (toByteBuffer().compareTo(other.toByteBuffer()) == 0) { return true; } return false; } @Override boolean equals(byte[] other, int otherOffset, int otherLength) { if (toByteBuffer().compareTo(ByteBuffer.wrap(other, otherOffset, otherLength)) == 0) { return true; } return false; } @Override public int compareTo(Binary other) { byte[] bytes = getBytes(); return other.compareTo(bytes, 0, bytes.length); } @Override int compareTo(byte[] other, int otherOffset, int otherLength) { byte[] bytes = getBytes(); return Binary.compareTwoByteArrays(bytes, 0, bytes.length, other, otherOffset, otherLength); } @Override public ByteBuffer toByteBuffer() { ByteBuffer buf; value.mark(); value.position(offset); buf = value.slice(); buf.limit(length); value.reset(); return buf; } @Override public void writeTo(DataOutput out) throws IOException { for (int i = offset; i < offset + length; i++) { out.write(value.get(i)); } } }; }
Source:
public static long getDishCategoryId(final SQLiteDatabase db, final long dishId) { final Cursor c = db.rawQuery("SELECT " + CATEGORY_ID + " FROM " + TABLE_NAME + " WHERE " + DISH_ID + " =?", new String[] { String.valueOf(dishId) }); if (c != null) { try { if(c.moveToFirst()) { return c.getLong(c.getColumnIndex(CATEGORY_ID)); } } finally { c.close(); } } return -1; }

Target:
public static long getDishCategoryId(final SQLiteDatabase db, final long dishId) { List<Long> list = getDishCategoryIds(db, dishId); for (Long l : list) { return l; } return NO_DATA; }
Source:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { short firstBytes= ITypeMarshalBuffer.FUNCTION_TYPE; if (isConst()) firstBytes |= ITypeMarshalBuffer.FLAG1; if (isVolatile()) firstBytes |= ITypeMarshalBuffer.FLAG2; if (takesVarArgs()) firstBytes |= ITypeMarshalBuffer.FLAG3; buffer.putShort(firstBytes); buffer.putInt(parameters.length); buffer.marshalType(returnType); for (int i = 0; i < parameters.length; i++) { buffer.marshalType(parameters[i]); } }

Target:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { short firstBytes= ITypeMarshalBuffer.FUNCTION_TYPE; if (isConst()) firstBytes |= ITypeMarshalBuffer.FLAG1; if (takesVarArgs()) firstBytes |= ITypeMarshalBuffer.FLAG2; if (isVolatile()) firstBytes |= ITypeMarshalBuffer.FLAG3; buffer.putShort(firstBytes); buffer.putInt(parameters.length); buffer.marshalType(returnType); for (int i = 0; i < parameters.length; i++) { buffer.marshalType(parameters[i]); } }
Source:
public JavaScriptChecks addCustomChecks(@Nullable CustomJavaScriptRulesDefinition[] customRulesDefinitions, @Nullable CustomRuleRepository[] customRuleRepositories) { if (customRulesDefinitions != null) { for (CustomJavaScriptRulesDefinition rulesDefinition : customRulesDefinitions) { addChecks(rulesDefinition.repositoryKey(), ImmutableList.copyOf(rulesDefinition.checkClasses())); } } if (customRuleRepositories != null) { for (CustomRuleRepository repo : customRuleRepositories) { addChecks(repo.repositoryKey(), repo.checkClasses()); } } return this; }

Target:
public JavaScriptChecks addCustomChecks(@Nullable CustomJavaScriptRulesDefinition[] customRulesDefinitions, @Nullable CustomRuleRepository[] customRuleRepositories) { if (customRulesDefinitions != null) { LOG.warn("CustomJavaScriptRulesDefinition usage is deprecated. Use CustomRuleRepository API to define custom rules"); for (CustomJavaScriptRulesDefinition rulesDefinition : customRulesDefinitions) { addChecks(rulesDefinition.repositoryKey(), ImmutableList.copyOf(rulesDefinition.checkClasses())); } } if (customRuleRepositories != null) { for (CustomRuleRepository repo : customRuleRepositories) { addChecks(repo.repositoryKey(), repo.checkClasses()); } } return this; }
Source:
public TurboIssue(String repoId, Issue issue) { this.id = issue.getNumber(); this.title = issue.getTitle() == null ? "" : issue.getTitle(); this.creator = issue.getUser().getLogin(); this.createdAt = Utility.dateToLocalDateTime(issue.getCreatedAt()); this.isPullRequest = isPullRequest(issue); this.description = issue.getBody() == null ? "" : issue.getBody(); this.updatedAt = replaceNull(Utility.dateToLocalDateTime(issue.getUpdatedAt()), this.createdAt); this.commentCount = issue.getComments(); this.isOpen = issue.getState().equals(STATE_OPEN); this.assignee = issue.getAssignee() == null ? Optional.empty() : Optional.of(issue.getAssignee().getLogin()); this.labels = issue.getLabels().stream() .map(Label::getName) .collect(Collectors.toList()); this.milestone = issue.getMilestone() == null ? Optional.empty() : Optional.of(issue.getMilestone().getNumber()); this.metadata = new IssueMetadata(); this.repoId = repoId; this.markedReadAt = Optional.empty(); }

Target:
public TurboIssue(String repoId, Issue issue) { this.id = issue.getNumber(); this.title = issue.getTitle() == null ? "" : issue.getTitle(); this.creator = issue.getUser().getLogin(); this.createdAt = Utility.dateToLocalDateTime(issue.getCreatedAt()); this.isPullRequest = isPullRequest(issue); this.description = issue.getBody() == null ? "" : issue.getBody(); this.updatedAt = issue.getUpdatedAt() != null ? Utility.dateToLocalDateTime(issue.getUpdatedAt()) : this.createdAt; this.commentCount = issue.getComments(); this.isOpen = issue.getState().equals(STATE_OPEN); this.assignee = issue.getAssignee() == null ? Optional.empty() : Optional.of(issue.getAssignee().getLogin()); this.labels = issue.getLabels().stream() .map(Label::getName) .collect(Collectors.toList()); this.milestone = issue.getMilestone() == null ? Optional.empty() : Optional.of(issue.getMilestone().getNumber()); this.metadata = new IssueMetadata(); this.repoId = repoId; this.markedReadAt = Optional.empty(); }
Source:
public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (visible) { switch (property) { case ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR: { Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR); commandStream.setColor(newColor); commandColor.dispose(); commandColor = newColor; break; } case ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR: { Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR); messageStream.setColor(newColor); messageColor.dispose(); messageColor = newColor; break; } case ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR: { Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR); errorStream.setColor(newColor); errorColor.dispose(); errorColor = newColor; break; } case ICVSUIConstants.PREF_CONSOLE_FONT: setFont(((FontRegistry) event.getSource()).get(ICVSUIConstants.PREF_CONSOLE_FONT)); break; default: break; } } switch (property) { case ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE: Object value = event.getNewValue(); if (value instanceof String) { showOnMessage = Boolean.valueOf((String) value).booleanValue(); } else { showOnMessage = ((Boolean) value).booleanValue(); } break; case ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT: initLimitOutput(); break; case ICVSUIConstants.PREF_CONSOLE_WRAP: initWrapSetting(); break; default: break; } }

Target:
public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (visible) { switch (property) { case ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR: { Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_COMMAND_COLOR); commandStream.setColor(newColor); commandColor.dispose(); commandColor = newColor; return; } case ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR: { Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_MESSAGE_COLOR); messageStream.setColor(newColor); messageColor.dispose(); messageColor = newColor; return; } case ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR: { Color newColor = createColor(CVSUIPlugin.getStandardDisplay(), ICVSUIConstants.PREF_CONSOLE_ERROR_COLOR); errorStream.setColor(newColor); errorColor.dispose(); errorColor = newColor; return; } case ICVSUIConstants.PREF_CONSOLE_FONT: setFont(((FontRegistry) event.getSource()).get(ICVSUIConstants.PREF_CONSOLE_FONT)); return; default: break; } } switch (property) { case ICVSUIConstants.PREF_CONSOLE_SHOW_ON_MESSAGE: Object value = event.getNewValue(); if (value instanceof String) { showOnMessage = Boolean.valueOf((String) value).booleanValue(); } else { showOnMessage = ((Boolean) value).booleanValue(); } break; case ICVSUIConstants.PREF_CONSOLE_LIMIT_OUTPUT: initLimitOutput(); break; case ICVSUIConstants.PREF_CONSOLE_WRAP: initWrapSetting(); break; default: break; } }
Source:
void checkSymbol(Symbol symbol) { if (nonStaticReference || methodSymbol.equals(symbol) || symbol.isStatic()) { return; } final Symbol scopeOwner = scopeOwner(symbol); if (isConstructor(symbol)) { checkConstructor(scopeOwner); } else if (scopeOwner != null) { checkNonConstructor(symbol, scopeOwner); } }

Target:
void checkSymbol(Symbol symbol) { if (nonStaticReference || methodSymbol.equals(symbol) || symbol.isStatic()) { return; } Symbol scopeOwner = symbol.owner(); if (isConstructor(symbol)) { checkConstructor(scopeOwner); } else if (scopeOwner != null) { checkNonConstructor(scopeOwner); } }
Source:
protected WeldBeanDeploymentArchive processAnnotatedDiscovery(BeanArchiveBuilder builder) { Iterator<String> classIterator = builder.getClassIterator(); while (classIterator.hasNext()) { String className = classIterator.next(); ClassInfo cinfo = cindex.getClassByName(DotName.createSimple(className)); if (cinfo != null) { if (!containsBeanDefiningAnnotation(cinfo, className)) { classIterator.remove(); } } else { Class<?> clazz = Reflections.loadClass(resourceLoader, className); if (!Reflections.hasBeanDefiningAnnotation(clazz, initialBeanDefiningAnnotations)) { classIterator.remove(); } } } return builder.build(); }

Target:
protected WeldBeanDeploymentArchive processAnnotatedDiscovery(BeanArchiveBuilder builder) { Iterator<String> classIterator = builder.getClassIterator(); while (classIterator.hasNext()) { String className = classIterator.next(); ClassInfo cinfo = cindex.getClassByName(DotName.createSimple(className)); if (cinfo != null) { if (!containsBeanDefiningAnnotation(cinfo, className)) { classIterator.remove(); } } else { Class<?> clazz = Reflections.loadClass(resourceLoader, className); if (clazz == null || !Reflections.hasBeanDefiningAnnotation(clazz, initialBeanDefiningAnnotations)) { classIterator.remove(); } } } return builder.build(); }
Source:
public void dispose() { for (StreamInputReader reader : streamInputReaders) { if (reader != null) { reader.dispose(); } } }

Target:
public void dispose() { for (StreamInputReader reader : streamInputReaders) { if (reader != null) { reader.dispose(); } } streamInputReaders.clear(); }
Source:
public void start(BundleContext context) throws Exception { Dictionary<String, Object> properties = new Hashtable<>(); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS, Driver.class.getName()); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_NAME, "JDBC driver for MariaDB and MySQL"); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_VERSION, Version.majorVersion + "." + Version.minorVersion); service = context.registerService(DataSourceFactory.class, new MariaDbDataSourceFactory(), properties); }

Target:
public void start(BundleContext context) throws Exception { Dictionary<String, Object> properties = new Hashtable<>(); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS, Driver.class.getName()); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_NAME, MariaDbDatabaseMetaData.DRIVER_NAME); properties.put(DataSourceFactory.OSGI_JDBC_DRIVER_VERSION, Version.version); service = context.registerService(DataSourceFactory.class, new MariaDbDataSourceFactory(), properties); }
Source:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { if (syntaxNode.is(Tree.Kind.NEW_CLASS)) { NewClassTree newClassTree = (NewClassTree) syntaxNode; if (newClassTree.symbolType().is("java.io.ObjectOutputStream")) { ProgramState programState = context.getState(); FileOutputStreamConstraint constraint = programState.getConstraint(programState.peekValue(), FileOutputStreamConstraint.class); if (constraint == FileOutputStreamConstraint.APPEND) { context.reportIssue(syntaxNode, this, "This file was opened in append mode."); } } } return super.checkPreStatement(context, syntaxNode); }

Target:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { if (syntaxNode.is(Tree.Kind.NEW_CLASS)) { NewClassTree newClassTree = (NewClassTree) syntaxNode; if (newClassTree.symbolType().is("java.io.ObjectOutputStream") && newClassTree.arguments().size() == 1) { ProgramState programState = context.getState(); FileOutputStreamAppendConstraint constraint = programState.getConstraint(programState.peekValue(), FileOutputStreamAppendConstraint.class); if (constraint != null) { context.reportIssue( newClassTree.arguments().get(0), this, "Do not use a FileOutputStream in append mode.", ImmutableSet.of(Flow.of(new JavaFileScannerContext.Location("FileOutputStream created here.", constraint.node)))); } } } return super.checkPreStatement(context, syntaxNode); }
Source:
static <K, V> ViewQueryParameters<K, V> forwardPaginationQueryParameters (ViewQueryParameters<K, V> initialQueryParameters, K startkey, String startkey_docid) { ViewQueryParameters<K, V> pageParameters = new ViewQueryParameters<K, V> (initialQueryParameters); pageParameters.setStartKey(startkey); pageParameters.setStartKeyDocId(startkey_docid); pageParameters.inclusive_end = initialQueryParameters.inclusive_end; pageParameters.descending = initialQueryParameters.descending; if (initialQueryParameters.endkey != null) { pageParameters.setEndKey(initialQueryParameters.endkey); } pageParameters.setEndKeyDocId(initialQueryParameters.endkey_docid); copyNonPagingParameters(initialQueryParameters, pageParameters); return pageParameters; }

Target:
static <K, V> ViewQueryParameters<K, V> forwardPaginationQueryParameters (ViewQueryParameters<K, V> initialQueryParameters, K startkey, String startkey_docid) { ViewQueryParameters<K, V> pageParameters = initialQueryParameters.copy(); pageParameters.setStartKey(startkey); pageParameters.setStartKeyDocId(startkey_docid); return pageParameters; }
Source:
public Table getTable(String tableId) { if (tableManager != null) { return tableManager.getTable(tableId); } else { LOG.warn("No table found for Id: {}", tableId); return null; } }

Target:
public Table getTable(String tableId) { if (tableManager != null) { return tableManager.getTable(tableId); } else { LOG.warn("No table manager found"); return null; } }