auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Optional<RemoteInstance> getRemoteInstance(String applicationKey) { Optional<Integer> port = getSavedPort(applicationKey); if (!port.isPresent()) { return Optional.empty(); } SocketChannel channel = null; boolean close = true; try { channel = SocketChannel.open(); channel.configureBlocking(false); LOG.info("connecting to instance {}", port.get()); channel.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), port.get())); SocketChannel fChannel = channel; if (!TimeoutTask.attempt(t -> fChannel.finishConnect(), 1000, 10)) { return Optional.empty(); } LOG.info("connected to instance {}", port.get()); final byte[] bytes = applicationKey.getBytes(); ByteBuffer buf = ByteBuffer.allocate(bytes.length); tryFill(channel, buf, 1000); if (buf.hasRemaining()) { return Optional.empty(); } buf.flip(); for (int i = 0; i < bytes.length; i++) { if (buf.get() != bytes[i]) { return Optional.empty(); } } close = false; return Optional.of(new RemoteInstance(channel)); } catch (Exception e) { return Optional.empty(); } finally { try { if (channel != null && close && channel.isOpen()) { channel.close(); } } catch (Exception e) { } } }

Target:
public static Optional<RemoteInstance> getRemoteInstance(String applicationKey) { Optional<Integer> port = getSavedPort(applicationKey); if (!port.isPresent()) { return Optional.empty(); } SocketChannel channel = null; boolean close = true; try { channel = SocketChannel.open(); channel.configureBlocking(false); LOG.info("connecting to instance {}", port.get()); channel.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), port.get())); SocketChannel fChannel = channel; if (!TimeoutTask.attempt(t -> fChannel.finishConnect(), 1000, 10)) { return Optional.empty(); } LOG.info("connected to instance {}", port.get()); final byte[] bytes = applicationKey.getBytes(); ByteBuffer buf = ByteBuffer.allocate(bytes.length); tryFill(channel, buf, 1000); if (buf.hasRemaining()) { return Optional.empty(); } buf.flip(); for (int i = 0; i < bytes.length; i++) { if (buf.get() != bytes[i]) { return Optional.empty(); } } close = false; return Optional.of(new RemoteInstance(channel)); } catch (Exception e) { return Optional.empty(); } finally { if (close) { IOUtils.closeQuietly(channel); } } }
Source:
private void processMatchingMilestonesByQuerySentence(List<PickerMilestone> milestones, String querySentence) { String[] userInputWords = querySentence.split(" "); Stream.of(userInputWords) .forEach(queryWord -> processMatchingMilestonesByQueryWord(milestones, queryWord)); }

Target:
private void processMatchingMilestonesByQuerySentence(List<PickerMilestone> milestones, String querySentence) { String[] queryWords = querySentence.split(" "); Stream.of(queryWords) .forEach(queryWord -> processMatchingMilestonesByQueryWord(milestones, queryWord)); }
Source:
public NodeProbe create(String host, int port, String username, String password) throws IOException { return new InternalNodeProbe(host, port, username, password); }

Target:
public NodeProbe create(String host, int port, String username, String password) throws IOException { return new InternalNodeProbe(); }
Source:
public void testNoArgRestore() throws Exception { BackupCommand backupCommand = new BackupCommand() { @Override protected HttpWrapper getHttpClient() { return mockHttpWrapper; } }; backupCommand.execute(); setupSystemProperties(SOLR_STANDALONE_TYPE); when(mockHttpWrapper.execute(any(URI.class))).thenReturn(mockResponse(HttpStatus.SC_OK, "")); RestoreCommand restoreCommand = new RestoreCommand() { @Override protected HttpWrapper getHttpClient() { return mockHttpWrapper; } }; restoreCommand.execute(); assertThat( consoleOutput.getOutput(), containsString(String.format("Restore of [%s] complete.", DEFAULT_CORE_NAME))); }

Target:
public void testNoArgRestore() throws Exception { setupSystemProperties(SOLR_STANDALONE_TYPE); RestoreCommand restoreCommand = new RestoreCommand() { @Override HttpResponse sendGetRequest(URI backupUri) { return mockResponse(HttpStatus.SC_OK, ""); } }; restoreCommand.execute(); }
Source:
void configureAdditionalDependencies(OperationContext context, CapabilityServiceBuilder serviceBuilder, ModelNode model, ListenerService service) throws OperationFailedException { ModelNode redirectBindingRef = ListenerResourceDefinition.REDIRECT_SOCKET.resolveModelAttribute(context, model); if (redirectBindingRef.isDefined()) { ServiceName serviceName = context.getCapabilityServiceName(REF_SOCKET_BINDING, redirectBindingRef.asString(), SocketBinding.class); serviceBuilder.addDependency(serviceName, SocketBinding.class, service.getRedirectSocket()); } ServiceName httpListenerRegistry = context.getCapabilityServiceName(Capabilities.REF_HTTP_LISTENER_REGISTRY, ListenerRegistry.class); serviceBuilder.addDependency(httpListenerRegistry, ListenerRegistry.class, ((HttpListenerService) service).getHttpListenerRegistry()); }

Target:
void configureAdditionalDependencies(OperationContext context, CapabilityServiceBuilder serviceBuilder, ModelNode model, ListenerService service) throws OperationFailedException { ModelNode redirectBindingRef = ListenerResourceDefinition.REDIRECT_SOCKET.resolveModelAttribute(context, model); if (redirectBindingRef.isDefined()) { ServiceName serviceName = context.getCapabilityServiceName(REF_SOCKET_BINDING, redirectBindingRef.asString(), SocketBinding.class); serviceBuilder.addDependency(serviceName, SocketBinding.class, service.getRedirectSocket()); } serviceBuilder.addCapabilityRequirement(Capabilities.REF_HTTP_LISTENER_REGISTRY, ListenerRegistry.class, ((HttpListenerService) service).getHttpListenerRegistry()); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_motion_tracking); final TextView rot0 = (TextView) findViewById(R.id.rotation0); final TextView rot1 = (TextView) findViewById(R.id.rotation1); final TextView rot2 = (TextView) findViewById(R.id.rotation2); final TextView rot3 = (TextView) findViewById(R.id.rotation3); final TextView pos0 = (TextView) findViewById(R.id.positionX); final TextView pos1 = (TextView) findViewById(R.id.positionY); final TextView pos2 = (TextView) findViewById(R.id.positionZ); final DecimalFormat fourDec = new DecimalFormat("0.0000"); mTangoClient = new TangoClient(this, false, false, false); poseCallBack = new poseUpdateListener(){ @Override public void onPoseUpdate(final VioStatus status) { final DecimalFormat fourDec = new DecimalFormat("0.0000"); runOnUiThread(new Runnable() { @Override public void run() { try { rot0.setText(fourDec.format(status.rotation[0])); rot1.setText(fourDec.format(status.rotation[1])); rot2.setText(fourDec.format(status.rotation[2])); rot3.setText(fourDec.format(status.rotation[3])); pos0.setText(fourDec.format(status.translation[0])); pos1.setText(fourDec.format(status.translation[1])); pos2.setText(fourDec.format(status.translation[2])); } catch (Exception e) { e.printStackTrace(); } } }); } }; poseUpdater(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_motion_tracking); final TextView rot0 = (TextView) findViewById(R.id.rotation0); final TextView rot1 = (TextView) findViewById(R.id.rotation1); final TextView rot2 = (TextView) findViewById(R.id.rotation2); final TextView rot3 = (TextView) findViewById(R.id.rotation3); final TextView pos0 = (TextView) findViewById(R.id.positionX); final TextView pos1 = (TextView) findViewById(R.id.positionY); final TextView pos2 = (TextView) findViewById(R.id.positionZ); mTangoClient = new TangoClient(this, false, false, false); poseCallBack = new poseUpdateListener(){ @Override public void onPoseUpdate(final VioStatus status) { final DecimalFormat fourDec = new DecimalFormat("0.0000"); runOnUiThread(new Runnable() { @Override public void run() { try { rot0.setText(fourDec.format(status.rotation[0])); rot1.setText(fourDec.format(status.rotation[1])); rot2.setText(fourDec.format(status.rotation[2])); rot3.setText(fourDec.format(status.rotation[3])); pos0.setText(fourDec.format(status.translation[0])); pos1.setText(fourDec.format(status.translation[1])); pos2.setText(fourDec.format(status.translation[2])); } catch (Exception e) { e.printStackTrace(); } } }); } }; poseUpdater(); }
Source:
public boolean shouldCollide(SolObject object, Fixture fixture, FactionManager factionManager) { if (object instanceof SolShip) { SolShip ship = (SolShip) object; if (ship.getHull().getShieldFixture() == fixture) { if (config.density > 0) { return false; } Shield shield = ship.getShield(); return shield != null && shield.canAbsorb(config.dmgType); } return true; } return true; }

Target:
public boolean shouldCollide(SolObject object, Fixture fixture, FactionManager factionManager) { if (object instanceof SolShip) { SolShip ship = (SolShip) object; if (this.ship == ship) { return false; } if (ship.getHull().getShieldFixture() == fixture) { if (config.density > 0) { return false; } Shield shield = ship.getShield(); return shield != null && shield.canAbsorb(config.dmgType); } return true; } return true; }
Source:
private String prepareResponse(String msgID, String targetURI, String sourceURI) throws FileOperationException { String response = null; String responseFilePath; File responseFile; try { if (MESSAGE_ID_ONE_TEMP.equals(msgID)) { responseFile = new File(getClass().getClassLoader().getResource(Constants.SyncML. SYNCML_RESPONSE).getFile()); responseFilePath = responseFile.getPath(); response = new String(Files.readAllBytes(Paths.get(responseFilePath))); if ((targetURI != null)&&(sourceURI != null)) { response = response.replaceAll(Constants.SyncML.SYNCML_SOURCE_URI, targetURI); response = response.replaceAll(Constants.SyncML.SYNCML_TARGET_URI, sourceURI); } } else if(MESSAGE_ID_TWO_TEMP.equals(msgID)){ responseFile = new File(getClass().getClassLoader().getResource(Constants.SyncML. SYNCML_SECOND_RESPONSE).getFile()); responseFilePath = responseFile.getPath(); response = new String(Files.readAllBytes(Paths.get(responseFilePath))); if ((targetURI != null)&&(sourceURI != null)) { response = response.replaceAll(Constants.SyncML.SYNCML_SOURCE_URI, targetURI); response = response.replaceAll(Constants.SyncML.SYNCML_TARGET_URI, sourceURI); } } } catch (IOException e) { String msg = "Syncml response file cannot be read."; logger.error(msg, e); throw new FileOperationException(msg, e); } return response; }

Target:
private String prepareResponse(String msgID, String targetURI, String sourceURI) throws FileOperationException { String response = null; String responseFilePath; File responseFile; try { if (SYNCML_FIRST_MESSAGE.equals(msgID)) { responseFile = new File(getClass().getClassLoader().getResource(Constants.SyncML. SYNCML_RESPONSE).getFile()); responseFilePath = responseFile.getPath(); response = new String(Files.readAllBytes(Paths.get(responseFilePath))); if ((targetURI != null)&&(sourceURI != null)) { response = response.replaceAll(Constants.SyncML.SYNCML_SOURCE_URI, targetURI); response = response.replaceAll(Constants.SyncML.SYNCML_TARGET_URI, sourceURI); } } else if(SYNCML_SECOND_MESSAGE.equals(msgID)){ responseFile = new File(getClass().getClassLoader().getResource(Constants.SyncML. SYNCML_SECOND_RESPONSE).getFile()); responseFilePath = responseFile.getPath(); response = new String(Files.readAllBytes(Paths.get(responseFilePath))); if ((targetURI != null)&&(sourceURI != null)) { response = response.replaceAll(Constants.SyncML.SYNCML_SOURCE_URI, targetURI); response = response.replaceAll(Constants.SyncML.SYNCML_TARGET_URI, sourceURI); } } } catch (IOException e) { String msg = "Syncml response file cannot be read."; log.error(msg, e); throw new FileOperationException(msg, e); } return response; }
Source:
public void initialize(HttpRequest request) { request.setInterceptor(credential); request.setNumberOfRetries(maxRequestRetries); request.setConnectTimeout(connectTimeoutMillis); request.setReadTimeout(readTimeoutMillis); HttpBackOffIOExceptionHandler exceptionHandler = new HttpBackOffIOExceptionHandler(new ExponentialBackOff()); if (sleeperOverride != null) { exceptionHandler.setSleeper(sleeperOverride); } LoggingResponseHandler loggingResponseHandler = new LoggingResponseHandler( new CredentialOrBackoffResponseHandler(), exceptionHandler, ImmutableSet.of(HttpStatus.SC_GONE, HttpStatus.SC_SERVICE_UNAVAILABLE), ImmutableSet.of(HTTP_SC_TOO_MANY_REQUESTS)); request.setUnsuccessfulResponseHandler(loggingResponseHandler); request.setIOExceptionHandler(loggingResponseHandler); if (Strings.isNullOrEmpty(request.getHeaders().getUserAgent())) { logger.atFiner().log( "Request is missing a user-agent, adding default value of '%s'", defaultUserAgent); request.getHeaders().setUserAgent(defaultUserAgent); } if (headers != null) { for (Map.Entry<String, String> header : headers.entrySet()) { request.getHeaders().set(header.getKey(), header.getValue()); } } }

Target:
public void initialize(HttpRequest request) { request.setInterceptor(credential); request.setNumberOfRetries(maxRequestRetries); request.setConnectTimeout(connectTimeoutMillis); request.setReadTimeout(readTimeoutMillis); HttpBackOffIOExceptionHandler exceptionHandler = new HttpBackOffIOExceptionHandler(new ExponentialBackOff()); if (sleeperOverride != null) { exceptionHandler.setSleeper(sleeperOverride); } LoggingResponseHandler loggingResponseHandler = new LoggingResponseHandler( new CredentialOrBackoffResponseHandler(), exceptionHandler, ImmutableSet.of(HttpStatus.SC_GONE, HttpStatus.SC_SERVICE_UNAVAILABLE), ImmutableSet.of(HTTP_SC_TOO_MANY_REQUESTS)); request.setUnsuccessfulResponseHandler(loggingResponseHandler); request.setIOExceptionHandler(loggingResponseHandler); if (Strings.isNullOrEmpty(request.getHeaders().getUserAgent())) { logger.atFiner().log( "Request is missing a user-agent, adding default value of '%s'", defaultUserAgent); request.getHeaders().setUserAgent(defaultUserAgent); } for (Map.Entry<String, String> header : headers.entrySet()) { request.getHeaders().set(header.getKey(), header.getValue()); } }
Source:
public static long castToLong(@SqlType(StandardTypes.DOUBLE) double value) { if (value >= Long.MAX_VALUE || value <= Long.MIN_VALUE) { throw new PrestoException(NUMERIC_VALUE_OUT_OF_RANGE, "Out of range for bigint: " + value); } return (long) MathFunctions.round(value); }

Target:
public static long castToLong(@SqlType(StandardTypes.DOUBLE) double value) { try { return DoubleMath.roundToLong(value, HALF_UP); } catch (ArithmeticException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Unable to cast %s to bigint", value), e); } }
Source:
public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) { this.traceOperation(context, "write", message); if (message instanceof RntbdRequestRecord) { final RntbdRequestRecord record = (RntbdRequestRecord) message; this.timestamps.channelWriteAttempted(); record.setSendingRequestHasStarted(); context.write(this.addPendingRequestRecord(context, record), promise).addListener(completed -> { record.stage(RntbdRequestRecord.Stage.SENT); if (completed.isSuccess()) { this.timestamps.channelWriteCompleted(); } }); return; } if (message == RntbdHealthCheckRequest.MESSAGE) { context.writeAndFlush(RntbdHealthCheckRequest.MESSAGE, promise).addListener(completed -> { if (completed.isSuccess()) { this.timestamps.channelPingCompleted(); } }); return; } final IllegalStateException error = new IllegalStateException(lenientFormat("message of %s: %s", message.getClass(), message)); reportIssue(context, "", error); this.exceptionCaught(context, error); }

Target:
public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) { this.traceOperation(context, "write", message); if (message instanceof RntbdRequestRecord) { final RntbdRequestRecord record = (RntbdRequestRecord) message; this.timestamps.channelWriteAttempted(); record.setSendingRequestHasStarted(); context.write(this.addPendingRequestRecord(context, record), promise).addListener(completed -> { record.stage(RntbdRequestRecord.Stage.SENT); if (completed.isSuccess()) { this.timestamps.channelWriteCompleted(); } }); return; } if (message == RntbdHealthCheckRequest.MESSAGE) { context.write(RntbdHealthCheckRequest.MESSAGE, promise).addListener(completed -> { if (completed.isSuccess()) { this.timestamps.channelPingCompleted(); } }); return; } final IllegalStateException error = new IllegalStateException(lenientFormat("message of %s: %s", message.getClass(), message)); reportIssue(context, "", error); this.exceptionCaught(context, error); }
Source:
private static Iterable<Slice> getGeometrySlicesFromBlock(Block block) { requireNonNull(block, "block is null"); return () -> new Iterator<Slice>() { private final int blockPositionCount = block.getPositionCount(); private int iteratorPosition; @Override public boolean hasNext() { return iteratorPosition != blockPositionCount; } @Override public Slice next() { if (!hasNext()) { throw new NoSuchElementException("Slices have been consumed"); } return GEOMETRY.getSlice(block, iteratorPosition++); } }; }

Target:
private static Iterable<Slice> getGeometrySlicesFromBlock(Block block) { requireNonNull(block, "block is null"); return () -> new Iterator<Slice>() { private int iteratorPosition; @Override public boolean hasNext() { return iteratorPosition != block.getPositionCount(); } @Override public Slice next() { if (!hasNext()) { throw new NoSuchElementException("Slices have been consumed"); } return GEOMETRY.getSlice(block, iteratorPosition++); } }; }
Source:
public static double[][] removeSelfRatings(double[][] input) { double[][] output = new double[input.length][input.length]; for (int i = 0; i < input.length; i++) { for (int j = 0; j < input[i].length; j++) { output[i][j] = (i == j) ? NA : input[i][j]; } } return output; }

Target:
public static double[][] removeSelfRatings(double[][] input) { double[][] output = new double[input.length][input.length]; for (int i = 0; i < input.length; i++) { for (int j = 0; j < input[i].length; j++) { output[i][j] = i == j ? NA : input[i][j]; } } return output; }
Source:
private int readInternal(String path, ByteBuffer buf, long size, long offset, FuseFileInfo fi) { int nread = 0; int rd = 0; final int sz = (int) size; long fd = fi.fh.get(); try (LockResource r1 = new LockResource(getFileLock(fd).writeLock())) { FileInStream is = mOpenFileEntries.get(fd); if (is == null) { LOG.error("Cannot find fd for {}", fd, path); return -ErrorCodes.EBADFD(); } is.seek(offset); final byte[] dest = new byte[sz]; while (rd >= 0 && nread < size) { rd = is.read(dest, nread, sz - nread); if (rd >= 0) { nread += rd; } } if (nread == -1) { nread = 0; } else if (nread > 0) { buf.put(dest, 0, nread); } } catch (Throwable e) { LOG.error("Failed to read {},{},{}: ", path, size, offset, e); return -ErrorCodes.EIO(); } return nread; }

Target:
private int readInternal(String path, ByteBuffer buf, long size, long offset, FuseFileInfo fi) { int nread = 0; int rd = 0; final int sz = (int) size; long fd = fi.fh.get(); try (LockResource r1 = new LockResource(mFileLocks.get(fd).writeLock())) { FileInStream is = mOpenFileEntries.get(fd); if (is == null) { LOG.error("Cannot find fd for {}", fd, path); return -ErrorCodes.EBADFD(); } is.seek(offset); final byte[] dest = new byte[sz]; while (rd >= 0 && nread < size) { rd = is.read(dest, nread, sz - nread); if (rd >= 0) { nread += rd; } } if (nread == -1) { nread = 0; } else if (nread > 0) { buf.put(dest, 0, nread); } } catch (Throwable e) { LOG.error("Failed to read, path: size: offset: {}", path, size, offset, e); return -ErrorCodes.EIO(); } return nread; }
Source:
public String getTypeFilterRegex() { return typeFilterRegex; }

Target:
public RegexParameterizedPatternParser getTypeFilterRegex() { return typeFilterPattern; }
Source:
public Builder setAsyncMutatorWorkerCount(int asyncMutatorCount) { this.asyncMutatorCount = asyncMutatorCount; return this; }

Target:
public Builder setAsyncMutatorWorkerCount(int asyncMutatorCount) { Preconditions.checkArgument( asyncMutatorCount > 0, "asyncMutatorCount must be greater than 0."); this.asyncMutatorCount = asyncMutatorCount; return this; }
Source:
public static void main(String[] args) { Flux<EventData> telemetryEvents = Flux.just( new EventData("Roast beef".getBytes(UTF_8)), new EventData("Cheese".getBytes(UTF_8)), new EventData("Tofu".getBytes(UTF_8)), new EventData("Turkey".getBytes(UTF_8))); System.setProperty("AZURE_CLIENT_ID", "<<insert-service-principal-client-id>>"); System.setProperty("AZURE_CLIENT_ID", "<<insert-service-principal-client-application-secret>>"); System.setProperty("AZURE_TENANT_ID", "<<insert-service-principal-tenant-id>>"); TokenCredential credential = new DefaultAzureCredentialBuilder() .build(); EventHubProducerAsyncClient producer = new EventHubClientBuilder() .credential( "<<fully-qualified-namespace>>", "<<event-hub-name>>", credential) .buildAsyncProducerClient(); final AtomicReference<EventDataBatch> currentBatch = new AtomicReference<>( producer.createBatch().block()); telemetryEvents.subscribe(event -> { final EventDataBatch batch = currentBatch.get(); if (!batch.tryAdd(event)) { producer.createBatch().map(newBatch -> { currentBatch.set(newBatch); newBatch.tryAdd(event); return producer.send(batch); }).block(); } }, error -> System.err.println("Error received:" + error), () -> { final EventDataBatch batch = currentBatch.getAndSet(null); if (batch != null) { producer.send(batch).block(); } }); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } finally { producer.close(); } }

Target:
public static void main(String[] args) { Flux<EventData> telemetryEvents = Flux.just( new EventData("Roast beef".getBytes(UTF_8)), new EventData("Cheese".getBytes(UTF_8)), new EventData("Tofu".getBytes(UTF_8)), new EventData("Turkey".getBytes(UTF_8))); System.setProperty("AZURE_CLIENT_ID", "<<insert-service-principal-client-id>>"); System.setProperty("AZURE_CLIENT_ID", "<<insert-service-principal-client-application-secret>>"); System.setProperty("AZURE_TENANT_ID", "<<insert-service-principal-tenant-id>>"); TokenCredential credential = new DefaultAzureCredentialBuilder() .build(); EventHubProducerAsyncClient producer = new EventHubClientBuilder() .credential( "<<fully-qualified-namespace>>", "<<event-hub-name>>", credential) .buildAsyncProducerClient(); final AtomicReference<EventDataBatch> currentBatch = new AtomicReference<>( producer.createBatch().block()); final Mono<Void> sendOperation = telemetryEvents.flatMap(event -> { final EventDataBatch batch = currentBatch.get(); if (batch.tryAdd(event)) { return Mono.empty(); } return Mono.when( producer.send(batch), producer.createBatch().map(newBatch -> { currentBatch.set(newBatch); if (!newBatch.tryAdd(event)) { throw Exceptions.propagate(new IllegalArgumentException(String.format( "Event is too large for an empty batch. Max size: %s. Event: %s", newBatch.getMaxSizeInBytes(), event.getBodyAsString()))); } return newBatch; })); }).then() .doFinally(signal -> { final EventDataBatch batch = currentBatch.getAndSet(null); if (batch != null) { producer.send(batch).block(OPERATION_TIMEOUT); } }); try { sendOperation.block(OPERATION_TIMEOUT); } finally { producer.close(); } }
Source:
private void flush() { Set<String> oldActive = new HashSet<>(activeKeyOrder); Range effectiveRequested; final Range previousActive = Range.withLength(activeStart, activeKeyOrder.size()); if (definedSize && (resendEntireRange || sizeReset)) { assumedSize = getDataProviderSize(); } else if (!definedSize && (!skipCountIncreaseUntilReset || sizeReset)) { updateUndefinedSize(); } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); resendEntireRange |= !(previousActive.intersects(effectiveRequested) || (previousActive.isEmpty() && effectiveRequested.isEmpty())); Activation activation = collectKeysToFlush(previousActive, effectiveRequested); if (activation.isSizeRecheckNeeded()) { if (definedSize) { assumedSize = getDataProviderSize(); } else { assumedSize = requestedRange.getStart() + activation.getActiveKeys().size(); skipCountIncreaseUntilReset = true; if (assumedSize != 0 && activation.getActiveKeys().size() == 0) { int delta = requestedRange.length(); requestedRange = requestedRange.offsetBy(-delta); requestFlush(true); return; } } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); } activeKeyOrder = activation.getActiveKeys(); activeStart = effectiveRequested.getStart(); Update update = arrayUpdater.startUpdate(assumedSize); boolean updated = collectChangesToSend(previousActive, effectiveRequested, update); resendEntireRange = false; assumeEmptyClient = false; sizeReset = false; passivateInactiveKeys(oldActive, update, updated); unregisterPassivatedKeys(); fireItemCountEvent(assumedSize); }

Target:
private void flush() { Set<String> oldActive = new HashSet<>(activeKeyOrder); Range effectiveRequested; final Range previousActive = Range.withLength(activeStart, activeKeyOrder.size()); if (definedSize && (resendEntireRange || sizeReset)) { assumedSize = getDataProviderSize(); } else if (!definedSize && (!skipCountIncreaseUntilReset || sizeReset)) { updateUndefinedSize(); } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); resendEntireRange |= !(previousActive.intersects(effectiveRequested) || (previousActive.isEmpty() && effectiveRequested.isEmpty())); Activation activation = collectKeysToFlush(previousActive, effectiveRequested); if (activation.isSizeRecheckNeeded()) { if (definedSize) { assumedSize = getDataProviderSize(); } else { assumedSize = requestedRange.getStart() + activation.getActiveKeys().size(); skipCountIncreaseUntilReset = true; if (assumedSize != 0 && activation.getActiveKeys().isEmpty()) { int delta = requestedRange.length(); requestedRange = requestedRange.offsetBy(-delta); requestFlush(true); return; } } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); } activeKeyOrder = activation.getActiveKeys(); activeStart = effectiveRequested.getStart(); Update update = arrayUpdater.startUpdate(assumedSize); boolean updated = collectChangesToSend(previousActive, effectiveRequested, update); resendEntireRange = false; assumeEmptyClient = false; sizeReset = false; passivateInactiveKeys(oldActive, update, updated); unregisterPassivatedKeys(); fireItemCountEvent(assumedSize); }
Source:
private void logInfoMessage(String message) { logger.log(Level.INFO, String.format("%s (data source = %s, objId = %d, jobId = %d)", message, getDataSourceName(), getDataSourceId(), id)); }

Target:
private void logInfoMessage(String message) { logger.log(Level.INFO, String.format("%s (data source = %s, objId = %d, pipeline id = %d, ingest job id = %d)", message, this.dataSource.getName(), this.dataSource.getId(), id, ingestJob.getIngestJobId())); }
Source:
private Map<String, Ref> computeNewRefs() throws IOException { final Map<String, Ref> refs = new HashMap<String, Ref>(); try (final RevWalk rw = new RevWalk(db); final BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(refList), Constants.CHARSET))) { String line; while ((line = br.readLine()) != null) { final String[] parts = line.split("[ \t]{1,}"); final ObjectId origId = ObjectId.fromString(parts[0]); final String type = parts[1]; final String name = parts[2]; ObjectId id = rewrites.get(origId); if (id == null) id = origId; try { rw.parseAny(id); } catch (MissingObjectException mue) { if (!Constants.TYPE_COMMIT.equals(type)) { errw.println(MessageFormat.format(CLIText.get().skippingObject, type, name)); continue; } throw new MissingObjectException(id, type); } refs.put(name, new ObjectIdRef.Unpeeled(Ref.Storage.PACKED, name, id)); } } return refs; }

Target:
private Map<String, Ref> computeNewRefs() throws IOException { final Map<String, Ref> refs = new HashMap<String, Ref>(); try (RevWalk rw = new RevWalk(db); BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(refList), Constants.CHARSET))) { String line; while ((line = br.readLine()) != null) { final String[] parts = line.split("[ \t]{1,}"); final ObjectId origId = ObjectId.fromString(parts[0]); final String type = parts[1]; final String name = parts[2]; ObjectId id = rewrites.get(origId); if (id == null) id = origId; try { rw.parseAny(id); } catch (MissingObjectException mue) { if (!Constants.TYPE_COMMIT.equals(type)) { errw.println(MessageFormat.format(CLIText.get().skippingObject, type, name)); continue; } throw new MissingObjectException(id, type); } refs.put(name, new ObjectIdRef.Unpeeled(Ref.Storage.PACKED, name, id)); } } return refs; }
Source:
public void deactivate() { try { httpService.unregister(WEBAPP_ALIAS + SERVLET_NAME); } catch(IllegalArgumentException e) { logger.info("LgTv Servlet '{}' was not registered. Nothing to deactivate.", WEBAPP_ALIAS + SERVLET_NAME); } finally { logger.info("Stopped LgTv Servlet"); } }

Target:
public void deactivate() { try { httpService.unregister(WEBAPP_ALIAS + SERVLET_NAME); } catch(IllegalArgumentException e) { logger.debug("LgTv Servlet '{}' was not registered. Nothing to deactivate.", WEBAPP_ALIAS + SERVLET_NAME); } finally { logger.info("Stopped LgTv Servlet"); } }
Source:
public ListenableFuture<ResolvedEquivalents<E>> resolveIds(Iterable<Id> ids, ApplicationSources sources, Set<Annotation> activeAnnotations) { if(!activeAnnotations.contains(Annotation.NON_MERGED)) { ListenableFuture<ResolvedEquivalents<E>> unmerged = resolver.resolveIds(ids, sources.getEnabledReadSources(), activeAnnotations); return Futures.transform(unmerged, mergeUsing(sources)); } else { return resolver.resolveIdsWithoutEquivalence(ids, sources.getEnabledReadSources(), activeAnnotations); } }

Target:
public ListenableFuture<ResolvedEquivalents<E>> resolveIds(Iterable<Id> ids, ApplicationSources sources, Set<Annotation> activeAnnotations) { if(activeAnnotations.contains(Annotation.NON_MERGED)) { return resolver.resolveIdsWithoutEquivalence(ids, sources.getEnabledReadSources(), activeAnnotations); } else { ListenableFuture<ResolvedEquivalents<E>> unmerged = resolver.resolveIds(ids, sources.getEnabledReadSources(), activeAnnotations); return Futures.transform(unmerged, mergeUsing(sources)); } }
Source:
public void onBranchUnselected() { view.setEnableCheckoutButton(false); view.setEnableRenameButton(false); view.setEnableDeleteButton(false); }

Target:
public void onBranchUnselected() { selectedBranch = null; view.setEnableCheckoutButton(false); view.setEnableRenameButton(false); view.setEnableDeleteButton(false); }
Source:
private static String findActiveNicName(VDS vds, Map<String, Map<String, Object>> bridges) { final String hostIp = NetworkUtils.getHostByIp(vds); final VdsNetworkInterface activeIface = resolveActiveNic(vds, hostIp); String hostActiveNic = (activeIface == null) ? null : activeIface.getName(); final String activeBridge = findActiveBridge(hostIp, bridges); if (activeBridge != null) { hostActiveNic = activeBridge; } return hostActiveNic; }

Target:
private static String findActiveNicName(VDS vds, Map<String, Map<String, Object>> bridges) { final String hostIp = NetworkUtils.getHostByIp(vds); final String activeBridge = findActiveBridge(hostIp, bridges); if (activeBridge != null) { return activeBridge; } final VdsNetworkInterface activeIface = resolveActiveNic(vds, hostIp); String hostActiveNic = (activeIface == null) ? null : activeIface.getName(); return hostActiveNic; }
Source:
protected void initImportClonedTemplateDisks() { for (DiskImage image : getImages()) { if (Guid.isNullOrEmpty(image.getStoragePoolId())) { image.setStoragePoolId(getStoragePoolId()); } if (Guid.isNullOrEmpty(getParameters().getSourceDomainId())) { getParameters().setSourceDomainId(storageDomainDao.getMasterStorageDomainIdForPool(image.getStoragePoolId())); } updateDiskSizeByQcowImageInfo(image); if (getParameters().isImportAsNewEntity()) { generateNewDiskId(image); updateManagedDeviceMap(image, getVmTemplate().getManagedDeviceMap()); } else { originalDiskIdMap.put(image.getId(), image.getId()); originalDiskImageIdMap.put(image.getId(), image.getImageId()); } } }

Target:
protected void initImportClonedTemplateDisks() { for (DiskImage image : getImages()) { if (getParameters().isImportAsNewEntity()) { generateNewDiskId(image); updateManagedDeviceMap(image, getVmTemplate().getManagedDeviceMap()); } else { originalDiskIdMap.put(image.getId(), image.getId()); originalDiskImageIdMap.put(image.getId(), image.getImageId()); } } }
Source:
public LibraryPage deleteNote(String noteText) { for (WebElement noteElement : notes) { Note note = new Note(noteElement.getText()); if (noteText.equals(note.getText())) { WebElement html = getHtmlElement(); WebElement deleteButton = noteElement.findElement(DELETE_NOTE_SELECTOR); deleteButton.click(); waitExplicitly(500); getDriver().findElement(By.id("ok")).click(); waitForPageRefresh(html); return new LibraryPage(getDriver()); } } throw new IllegalArgumentException("Note not found"); }

Target:
public LibraryPage deleteNote(String noteText) { for (WebElement noteElement : notes) { Note note = new Note(noteElement.getText()); if (noteText.equals(note.getText())) { WebElement html = getHtmlElement(); WebElement deleteButton = noteElement.findElement(DELETE_NOTE_SELECTOR); deleteButton.click(); waitUntil(visibilityOf(getDriver().findElement(By.id("ok")))); getDriver().findElement(By.id("ok")).click(); waitForPageRefresh(html); return new LibraryPage(getDriver()); } } throw new IllegalArgumentException("Note not found"); }
Source:
protected String extractRootPrefix(final String uri, final StringBuilder name) throws FileSystemException { if (name.length() == 0 || name.charAt(0) == '/') { throw new FileSystemException("vfs.provider.res/not-valid-resource-location.error", uri); } return "/"; }

Target:
protected String extractRootPrefix(final String uri, final StringBuilder name) throws FileSystemException { int index = 0; while (index < name.length() && name.charAt(index) == '/') { ++index; } if (index > 0) { name.delete(0, index); } if (name.length() == 0) { throw new FileSystemException("vfs.provider.res/not-valid-resource-location.error", uri); } return "/"; }
Source:
private DocumentChangeListenerToken addDocumentChangeListener(Executor executor, DocumentChangeListener listener, String docID) { if (!docListenerTokens.containsKey(docID)) { Set<DocumentChangeListenerToken> listeners = Collections.synchronizedSet(new HashSet<DocumentChangeListenerToken>()); docListenerTokens.put(docID, listeners); registerC4DocObserver(docID); } DocumentChangeListenerToken token = new DocumentChangeListenerToken(executor, listener, docID); docListenerTokens.get(docID).add(token); return token; }

Target:
private DocumentChangeListenerToken addDocumentChangeListener(Executor executor, DocumentChangeListener listener, String docID) { if (!docListenerTokens.containsKey(docID)) { Set<DocumentChangeListenerToken> listeners = new HashSet<>(); docListenerTokens.put(docID, listeners); registerC4DocObserver(docID); } DocumentChangeListenerToken token = new DocumentChangeListenerToken(executor, listener, docID); docListenerTokens.get(docID).add(token); return token; }
Source:
public int getCount() { if (App.getInstance().isOrganizer()) { return 4; } else { return 3; } }

Target:
public int getCount() { return mPages.length; }
Source:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); fFile = new File(path); try { fFileInput = new RandomAccessFile(fFile, "r"); parseHeader(); } catch (IOException e) { } }

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> type) throws TmfTraceException { super.initTrace(resource, path, type); fFile = new File(path); try { fFileInput = new RandomAccessFile(fFile, "r"); parseHeader(fFileInput); } catch (IOException e) { } }
Source:
public void onTextMessage(@PathParam("name") String name, String text, Session session) throws IOException { String msg = name + " : " + text; LOGGER.info("Received Text : " + text + " from " + name + session.getId()); sendMessageToAll(msg); }

Target:
public void onTextMessage(@PathParam("name") String name, String text, Session session) throws IOException { String msg = name + " : " + text; logger.info("Received Text : " + text + " from " + name + session.getId()); sendMessageToAll(msg); }
Source:
public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, IProgressMonitor monitor) throws TeamException { monitor = Policy.monitorFor(monitor); monitor.beginTask(null, recurse ? 210 : 100); try { CVSTag[] tags = null; if (!folder.getFolderSyncInfo().isVirtualDirectory()) { tags = fetchTagsUsingAutoRefreshFiles(folder, Policy.subMonitorFor(monitor, 50)); } if (tags == null || tags.length == 0) { tags = fetchTagsUsingLog(folder, Policy.subMonitorFor(monitor, 50)); } if (tags != null && tags.length > 0) { String remotePath = getRemotePathFor(folder); addTags(remotePath, tags); return tags; } if (recurse) { Set<CVSTag> tagsSet = new HashSet<>(); folder.fetchChildren(Policy.subMonitorFor(monitor, 10)); ICVSResource[] children = folder .members(ICVSFolder.FOLDER_MEMBERS); for (ICVSResource children1 : children) { tagsSet.addAll(Arrays.asList(refreshDefinedTags((ICVSFolder) children1, recurse, Policy .subMonitorFor(monitor, 100 / children.length)))); } tags = tagsSet.toArray(new CVSTag[tagsSet.size()]); } return tags; } finally { monitor.done(); } }

Target:
public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, IProgressMonitor monitor) throws TeamException { monitor = Policy.monitorFor(monitor); monitor.beginTask(null, recurse ? 210 : 100); try { CVSTag[] tags = null; if (!folder.getFolderSyncInfo().isVirtualDirectory()) { tags = fetchTagsUsingAutoRefreshFiles(folder, Policy.subMonitorFor(monitor, 50)); } if (tags == null || tags.length == 0) { tags = fetchTagsUsingLog(folder, Policy.subMonitorFor(monitor, 50)); } if (tags != null && tags.length > 0) { String remotePath = getRemotePathFor(folder); addTags(remotePath, tags); return tags; } if (recurse) { Set<CVSTag> tagsSet = new HashSet<>(); folder.fetchChildren(Policy.subMonitorFor(monitor, 10)); ICVSResource[] children = folder .members(ICVSFolder.FOLDER_MEMBERS); for (ICVSResource child : children) { tagsSet.addAll(Arrays.asList(refreshDefinedTags((ICVSFolder) child, recurse, Policy .subMonitorFor(monitor, 100 / children.length)))); } tags = tagsSet.toArray(new CVSTag[tagsSet.size()]); } return tags; } finally { monitor.done(); } }
Source:
public static String jsonFromAnnotation(Annotation annotation) throws JSONException { JSONArray positions = new JSONArray(); for (int i = 0; i < annotation.positions.size(); i++) { Box box = annotation.positions.get(i); JSONObject topLeft = null; JSONObject bottomRight = null; if (box.topLeft != null) { topLeft = new JSONObject(); topLeft.put("x", box.topLeft.x); topLeft.put("y", box.topLeft.y); } if (box.bottomRight != null) { bottomRight = new JSONObject(); bottomRight.put("x", box.bottomRight.x); bottomRight.put("y", box.bottomRight.y); } JSONObject bbox = new JSONObject(); bbox.put("top_left", topLeft); bbox.put("bottom_right", bottomRight); bbox.put("page", box.page); positions.put(i, bbox); } JSONObject color = new JSONObject(); color.put("r", Color.red(annotation.color)); color.put("g", Color.green(annotation.color)); color.put("b", Color.blue(annotation.color)); JSONObject jAnnotation = new JSONObject(); jAnnotation.put("id", annotation.id); jAnnotation.put("type", annotation.type.name); jAnnotation.put("previous_id", annotation.previousId); jAnnotation.put("color", color); jAnnotation.put("text", annotation.text); jAnnotation.put("profile_id", annotation.profileId); jAnnotation.put("positions", positions); jAnnotation.put("created", annotation.created); jAnnotation.put("last_modified", annotation.lastModified); jAnnotation.put("privacy_level", annotation.privacyLevel.name); jAnnotation.put("filehash", annotation.fileHash); jAnnotation.put("document_id", annotation.documentId); return jAnnotation.toString(); }

Target:
public static String jsonFromAnnotation(Annotation annotation) throws JSONException { JSONArray positions = new JSONArray(); for (int i = 0; i < annotation.positions.size(); i++) { Box box = annotation.positions.get(i); positions.put(i, serializeBox(box)); } JSONObject jAnnotation = new JSONObject(); jAnnotation.put("id", annotation.id); jAnnotation.put("type", annotation.type.name); jAnnotation.put("previous_id", annotation.previousId); jAnnotation.put("color", serializeColor(annotation.color)); jAnnotation.put("text", annotation.text); jAnnotation.put("profile_id", annotation.profileId); jAnnotation.put("positions", positions); jAnnotation.put("created", annotation.created); jAnnotation.put("last_modified", annotation.lastModified); jAnnotation.put("privacy_level", annotation.privacyLevel.name); jAnnotation.put("filehash", annotation.fileHash); jAnnotation.put("document_id", annotation.documentId); return jAnnotation.toString(); }
Source:
public static TLSClientParametersFactory getInstance() { if (tlsCPFactory == null) { tlsCPFactory = new TLSClientParametersFactory(); } return tlsCPFactory; }

Target:
public static TLSClientParametersFactory getInstance() { return tlsCPFactory; }
Source:
public void onLoad() { super.onLoad(); keyHandler = Event.addNativePreviewHandler(event -> { NativeEvent nativeEvent = event.getNativeEvent(); if (breadCrumbs != null) { if (event.getTypeInt() == Event.ONKEYDOWN) { if (nativeEvent.getCharCode() == 's' || nativeEvent.getKeyCode() == KeyCodes.KEY_S) { if (nativeEvent.getCtrlKey() && nativeEvent.getAltKey()) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); SimpleTabPanel.this.breadCrumbs.toggleSearch(); event.cancel(); } } else if (!SimpleTabPanel.this.breadCrumbs.isSearchVisible() && nativeEvent.getKeyCode() == KeyCodes.KEY_DOWN) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); SimpleTabPanel.this.breadCrumbs.nextEntity(); event.cancel(); } else if (!SimpleTabPanel.this.breadCrumbs.isSearchVisible() && nativeEvent.getKeyCode() == KeyCodes.KEY_UP) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); SimpleTabPanel.this.breadCrumbs.previousEntity(); event.cancel(); } } } } ); if (breadCrumbs != null && breadCrumbsContainer.getWidgetCount() == 0) { breadCrumbs.asWidget().getElement().getStyle().setHeight(83, Unit.PX); breadCrumbsContainer.add(breadCrumbs); } if (actionPanel != null && mainActionPanel.getWidgetCount() == 0) { mainActionPanel.add(actionPanel); } }

Target:
public void onLoad() { super.onLoad(); keyHandler = Event.addNativePreviewHandler(event -> { NativeEvent nativeEvent = event.getNativeEvent(); if (breadCrumbs != null) { if (event.getTypeInt() == Event.ONKEYDOWN) { if (nativeEvent.getCharCode() == 's' || nativeEvent.getKeyCode() == KeyCodes.KEY_S) { if (nativeEvent.getCtrlKey() && nativeEvent.getAltKey()) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); SimpleTabPanel.this.breadCrumbs.toggleSearch(); event.cancel(); } } else if (!SimpleTabPanel.this.breadCrumbs.isSearchVisible() && nativeEvent.getKeyCode() == KeyCodes.KEY_DOWN) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); SimpleTabPanel.this.breadCrumbs.nextEntity(); event.cancel(); } else if (!SimpleTabPanel.this.breadCrumbs.isSearchVisible() && nativeEvent.getKeyCode() == KeyCodes.KEY_UP) { nativeEvent.preventDefault(); nativeEvent.stopPropagation(); SimpleTabPanel.this.breadCrumbs.previousEntity(); event.cancel(); } } } } ); if (breadCrumbs != null && breadCrumbsContainer.getWidgetCount() == 0) { breadCrumbsContainer.add(breadCrumbs); } if (actionPanel != null && mainActionPanel.getWidgetCount() == 0) { mainActionPanel.add(actionPanel); } }
Source:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { logger.debug("Refreshing channel {}", channelUID); coapClient.asyncGet(this); return; } logger.warn("The sensor is a read-only device and cannot handle commands."); }

Target:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { logger.debug("Refreshing channel {}", channelUID); coapClient.asyncGet(this); return; } logger.debug("The sensor is a read-only device and cannot handle commands."); }
Source:
public Comment post( @NotNull(message = "text should not be NULL") final String text ) throws IOException { this.storage.lock(); final int number; try { final String timestamp = new Github.Time().toString(); final String userrepo = this.repo.user() + "/" + this.repo.repo(); number = 1 + this.storage.xml() .nodes(" final String url = "<LINK_1>" + userrepo + "/issues/comments/" + number; this.storage.apply( new Directives().xpath(this.xpath()).add("comment") .add("number").set(Integer.toString(number)).up() .add("url").set(url).up() .add("body").set(text).up() .add("user") .add("login").set(this.self).up() .up() .add("created_at").set(timestamp).up() .add("updated_at").set(timestamp) ); } finally { this.storage.unlock(); } Logger.info( this, "comment #%d posted to issue #%d by %s: %[text]s", number, this.issue().number(), this.self, text ); return this.get(number); }

Target:
public Comment post( @NotNull(message = "text should not be NULL") final String text ) throws IOException { this.storage.lock(); final int number; try { final String timestamp = new Github.Time().toString(); number = 1 + this.storage.xml() .nodes(" this.storage.apply( new Directives().xpath(this.xpath()).add("comment") .add("number").set(Integer.toString(number)).up() .add("url") .set( String.format( "<LINK_0>", this.repo.user(), this.repo.repo(), number ) ) .up() .add("body").set(text).up() .add("user") .add("login").set(this.self).up() .up() .add("created_at").set(timestamp).up() .add("updated_at").set(timestamp) ); } finally { this.storage.unlock(); } Logger.info( this, "comment #%d posted to issue #%d by %s: %[text]s", number, this.issue().number(), this.self, text ); return this.get(number); }
Source:
public static CachedTimelines createEmpty(){ return new CachedTimelines(Collections.<Timeline>emptyList(), new String("")); }

Target:
public static CachedTimelines createEmpty(){ return new CachedTimelines(Collections.<Timeline>emptyList(), ""); }
Source:
private static void query(String token) { String s = skip(token); int c = s.indexOf(','); if (c >= 0) { Gerrit.display(token, new QueryScreen( s.substring(0, c), Integer.parseInt(s.substring(c + 1)))); } else { Gerrit.display(token, new QueryScreen(s, 0)); } }

Target:
private static void query(String token) { String s = skip(token); int c = s.indexOf(','); Screen screen; if (c >= 0) { String prefix = s.substring(0, c); if (!s.substring(c).equals(",n,z")) { screen = new QueryScreen(prefix, Integer.parseInt(s.substring(c + 1))); } else { screen = new QueryScreen(prefix, 0); } } else { screen = new QueryScreen(s, 0); } Gerrit.display(token, screen); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.action_append_playlist: appendAllToPlaylist(); return true; case R.id.action_system_audio: startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS)); return true; case R.id.action_switch_main: return switchTo(MainVideoPlayer.class); case R.id.action_set_timer: try { updateTimer(this); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), getString(R.string.error_setting_timer), Toast.LENGTH_SHORT).show(); } return true; } return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.action_append_playlist: appendAllToPlaylist(); return true; case R.id.action_system_audio: startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS)); return true; case R.id.action_switch_main: return switchTo(MainVideoPlayer.class); case R.id.action_set_timer: updateTimer(this); return true; } return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item); }