auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void _next() throws IOException { if (!hasTop) throw new IllegalStateException(); if (entriesLeft == 0) { currBlock.close(); if (metricsGatherer != null) metricsGatherer.startBlock(); if (iiter.hasNext()) { IndexEntry indexEntry = iiter.next(); entriesLeft = indexEntry.getNumEntries(); currBlock = getDataBlock(indexEntry); checkRange = range.afterEndKey(indexEntry.getKey()); if (!checkRange) hasTop = true; } else { rk = null; val = null; hasTop = false; return; } } prevKey = rk.getKey(); rk.readFields(currBlock); val.readFields(currBlock); if (metricsGatherer != null) metricsGatherer.addMetric(rk.getKey()); entriesLeft--; if (checkRange) hasTop = !range.afterEndKey(rk.getKey()); }

Target:
private void _next() throws IOException { if (!hasTop) throw new IllegalStateException(); if (entriesLeft == 0) { currBlock.close(); if (metricsGatherer != null) metricsGatherer.startBlock(); if (iiter.hasNext()) { IndexEntry indexEntry = iiter.next(); entriesLeft = indexEntry.getNumEntries(); currBlock = getDataBlock(indexEntry); checkRange = range.afterEndKey(indexEntry.getKey()); if (!checkRange) hasTop = true; } else { rk = null; val = null; hasTop = false; return; } } prevKey = rk.getKey(); rk.readFields(currBlock); val.readFields(currBlock); if (metricsGatherer != null) metricsGatherer.addMetric(rk.getKey(), val); entriesLeft--; if (checkRange) hasTop = !range.afterEndKey(rk.getKey()); }
Source:
protected <T> T getOrCreateComponent(Class<T> componentClass, String name) { return getOrCreateComponent(componentClass, name, true); }

Target:
protected <T> T getOrCreateComponent(Class<T> componentClass, String name) { return getOrCreateComponent(componentClass, name, false); }
Source:
InternalErrorCause getCause() { return null; }

Target:
ErrorCause getCause() { return ErrorCause.UNKNOWN; }
Source:
private boolean shouldReconnect(URL url) { boolean reconnect = url.getParameter(Constants.SEND_RECONNECT_KEY, false); if (!reconnect) { String param = url.getParameter(Constants.RECONNECT_KEY, "true"); if ("false".equalsIgnoreCase(param)) { reconnect = false; } else if ("true".equalsIgnoreCase(param)) { reconnect = true; } else { int value; try { value = Integer.parseInt(param); } catch (Exception e) { throw new IllegalArgumentException("reconnect param must be non-negative integer or false/true, " + "input is:" + param); } if (value < 0) { throw new IllegalArgumentException("reconnect param must be non-negative integer or false/true, " + "input is:" + param); } reconnect = true; } } return reconnect; }

Target:
private boolean shouldReconnect(URL url) { return url.getParameter(Constants.RECONNECT_KEY, true); }
Source:
public AbstractApplicationRunner(Config config) { super(config); systemAdmins = new SystemAdmins(config); this.streamManager = new StreamManager(systemAdmins); }

Target:
public AbstractApplicationRunner(Config config) { super(config); this.systemAdmins = new SystemAdmins(config); this.streamManager = new StreamManager(systemAdmins); }
Source:
public void updatePlanetarySystem(PlanetarySystem s) { this.system = s; selectedPlanet = system.getPrimaryPlanetPosition(); mapPanel.repaint(); }

Target:
public void updatePlanetarySystem(PlanetarySystem s) { if(null == s) { return; } this.system = s; selectedPlanet = system.getPrimaryPlanetPosition(); mapPanel.repaint(); }
Source:
public void testNestedMaps() throws Exception { Iterable<String> keys = transform(intsBetween(0, 100_000), Object::toString); Iterable<Integer> valueMapKeys = intsBetween(0, 100_000); Iterable<String> valueMapValues = limit(cycle(Arrays.asList(null, "value2", "value3", null, null, "value6", "value7")), 100_000); List<Map<Integer, String>> valueMaps = createTestMap(valueMapKeys, valueMapValues); List<Map<String, Map<Integer, String>>> values = createTestMap(keys, valueMaps); tester.testRoundTrip( getStandardMapObjectInspector( javaStringObjectInspector, getStandardMapObjectInspector(javaIntObjectInspector, javaStringObjectInspector)), values, values, mapType(VARCHAR, mapType(INTEGER, VARCHAR))); }

Target:
public void testNestedMaps() throws Exception { int nestingLevel = ThreadLocalRandom.current().nextInt(1, 15); Iterable<Integer> keys = intsBetween(0, 3_210); Iterable maps = limit(cycle(asList(null, "value2", "value3", null, null, "value6", "value7")), 3_210); ObjectInspector objectInspector = getStandardMapObjectInspector(javaIntObjectInspector, javaStringObjectInspector); Type type = mapType(INTEGER, VARCHAR); for (int i = 0; i < nestingLevel; i++) { maps = createNullableTestMaps(keys, maps); objectInspector = getStandardMapObjectInspector(javaIntObjectInspector, objectInspector); type = mapType(INTEGER, type); } maps = createTestMaps(keys, maps); tester.testRoundTrip(objectInspector, maps, maps, type); }
Source:
public void resetDeviceToFactoryFW(@Scope(OAuthScope.ADMINISTRATION_WRITE) final AccessToken accessToken, @PathParam("device_id") final String deviceId, @QueryParam("fw_version") final Integer fwVersion) { if(deviceId == null) { LOGGER.error("Missing device_id parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } if(fwVersion == null) { LOGGER.error("Missing fw_version parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } LOGGER.info("Resetting device: on FW Version: {}", deviceId, fwVersion); final Map<String, Object> issuedCommands = new HashMap<>(); issuedCommands.put("reset_mcu", true); responseCommandsDAODynamoDB.insertResponseCommands(deviceId, fwVersion, issuedCommands); }

Target:
public void resetDeviceToFactoryFW(@Scope(OAuthScope.ADMINISTRATION_WRITE) final AccessToken accessToken, @PathParam("device_id") final String deviceId, @QueryParam("fw_version") final Integer fwVersion) { if(deviceId == null) { LOGGER.error("Missing device_id parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } if(fwVersion == null) { LOGGER.error("Missing fw_version parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } LOGGER.info("Resetting device: on FW Version: {}", deviceId, fwVersion); final Map<ResponseCommand, String> issuedCommands = new HashMap<>(); issuedCommands.put(ResponseCommand.RESET_MCU, "true"); responseCommandsDAODynamoDB.insertResponseCommands(deviceId, fwVersion, issuedCommands); }
Source:
private ThingHandler replaceThing(Thing oldThing, Thing newThing) { final ThingHandler thingHandler = thingHandlers.get(newThing.getUID()); if (oldThing.equals(newThing)) { this.things.remove(oldThing); this.things.add(newThing); } return thingHandler; }

Target:
private ThingHandler replaceThing(Thing oldThing, Thing newThing) { final ThingHandler thingHandler = thingHandlers.get(newThing.getUID()); if (oldThing != newThing) { this.things.remove(oldThing); this.things.add(newThing); } return thingHandler; }
Source:
protected String getShellName() { return "infoBundle"; }

Target:
protected String getShellName() { return "collectInfo"; }
Source:
private GeoAreaPoints getPointsList(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException { BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_AREAPOINTS); if (attribute == null) { LOGGER.log(Level.SEVERE, "No TSK_GEO_AREAPOINTS attribute was present on the artifact."); throw new GeoLocationDataException("No TSK_GEO_AREAPOINTS attribute present in attribute map to parse."); } try { return BlackboardJsonAttrUtil.fromAttribute(attribute, GeoAreaPoints.class); } catch (InvalidJsonException ex) { LOGGER.log(Level.SEVERE, "TSK_GEO_AREAPOINTS could not be properly parsed from TSK_GEO_AREAPOINTS attribute."); throw new GeoLocationDataException("Unable to parse area points in TSK_GEO_AREAPOINTS attribute", ex); } }

Target:
private GeoAreaPoints getPointsList(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException { BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_AREAPOINTS); if (attribute == null) { throw new GeoLocationDataException("No TSK_GEO_AREAPOINTS attribute present in attribute map to parse."); } try { return BlackboardJsonAttrUtil.fromAttribute(attribute, GeoAreaPoints.class); } catch (InvalidJsonException ex) { throw new GeoLocationDataException("Unable to parse area points in TSK_GEO_AREAPOINTS attribute", ex); } }
Source:
public TestingJobManagerRunner createJobManagerRunner(JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerSharedServices jobManagerSharedServices, JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory, FatalErrorHandler fatalErrorHandler) throws Exception { jobManagerRunnerCreationLatch.run(); TestingJobManagerRunner runner = super.createJobManagerRunner(jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, jobManagerJobMetricGroupFactory, fatalErrorHandler); if (jobMasterGateway != null) { runner.getJobMasterGateway().complete(jobMasterGateway); } return runner; }

Target:
public TestingJobManagerRunner createJobManagerRunner(JobGraph jobGraph, Configuration configuration, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, JobManagerSharedServices jobManagerSharedServices, JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory, FatalErrorHandler fatalErrorHandler) throws Exception { jobManagerRunnerCreationLatch.run(); TestingJobManagerRunner testingRunner = super.createJobManagerRunner( jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, jobManagerJobMetricGroupFactory, fatalErrorHandler); TestingJobMasterGateway testingJobMasterGateway = new TestingJobMasterGatewayBuilder() .setRequestJobSupplier(() -> CompletableFuture.completedFuture(ArchivedExecutionGraph.createFromInitializingJob(jobGraph.getJobID(), jobGraph.getName(), JobStatus.RUNNING, null, 1337)) ).build(); testingRunner.completeJobMasterGatewayFuture(testingJobMasterGateway); return testingRunner; }
Source:
public boolean isValid(ILaunchConfiguration config) { setErrorMessage(null); setMessage(null); if (gdbServer != null) { switch (gdbServer) { case JTAG_OPENOCD: if (groupcom.isDisposed()) { return true; } if (!isValidFileFieldEditor(fOpenOCDBinPath)) { return false; } if (ftdiDevice == FtdiDevice.CUSTOM) { if (!isValidFileFieldEditor(fOpenOCDConfigPath)) { return false; } } else { File cfg_file = new File(openocd_cfg_path); if (!cfg_file.exists()) { setErrorMessage("Default OpenOCD configuration file for this development system \'" + openocd_cfg_path + "\' must exist"); return false; } } break; case JTAG_ASHLING: if (groupcomashling.isDisposed()){ return true; } if (!isValidFileFieldEditor(fAshlingBinPath) || !isValidFileFieldEditor(fAshlingXMLPath)) { return false; } break; case NSIM: if (groupnsim.isDisposed()) { return true; } if (!isValidFileFieldEditor(fnSIMBinPath) || (fLaunchtcfButton.getSelection() && !isValidFileFieldEditor(fnSIMTCFPath)) || (fLaunchPropsButton.getSelection() && !isValidFileFieldEditor(fnSIMPropsPath))) { return false; } break; default: break; } } return true; }

Target:
public boolean isValid(ILaunchConfiguration config) { setErrorMessage(null); setMessage(null); if (gdbServer != null) { switch (gdbServer) { case JTAG_OPENOCD: if (groupcom.isDisposed()) { return true; } if (!isValidFileFieldEditor(fOpenOCDBinPath)) { return false; } if (ftdiDevice == FtdiDevice.CUSTOM) { if (!isValidFileFieldEditor(fOpenOCDConfigPath)) { return false; } } else { File cfg_file = new File(openocd_cfg_path); if (!cfg_file.exists()) { setErrorMessage("Default OpenOCD configuration file for this development system \'" + openocd_cfg_path + "\' must exist"); return false; } } break; case JTAG_ASHLING: if (groupcomashling.isDisposed()){ return true; } if (!isValidFileFieldEditor(fAshlingBinPath) || !isValidFileFieldEditor(fAshlingXMLPath)) { return false; } break; case NSIM: if (groupnsim.isDisposed()) { return true; } if (!isValidFileFieldEditor(fnSIMBinPath) || (fLaunchtcfButton.getSelection() && !isValidFileFieldEditor(fnSIMTCFPath)) || (fLaunchPropsButton.getSelection() && !isValidFileFieldEditor(fnSIMPropsPath))) { return false; } break; case GENERIC_GDBSERVER: break; default: throw new IllegalArgumentException("Unknown enum value has been used"); } } return true; }
Source:
public Mono<FunctionApp> createAsync() { if (this.isInCreateMode()) { if (inner().serverFarmId() == null) { withNewConsumptionPlan(); } if (currentStorageAccount == null && storageAccountToSet == null && storageAccountCreatable == null) { withNewStorageAccount( this.manager().sdkContext().randomResourceName(name(), 20), StorageAccountSkuType.fromSkuName(com.azure.resourcemanager.storage.models.SkuName.STANDARD_GRS)); } } return super.createAsync(); }

Target:
public Mono<FunctionApp> createAsync() { if (this.isInCreateMode()) { if (inner().serverFarmId() == null) { withNewConsumptionPlan(); } if (currentStorageAccount == null && storageAccountToSet == null && storageAccountCreatable == null) { withNewStorageAccount( this.manager().sdkContext().randomResourceName(name(), 20), StorageAccountSkuType.STANDARD_GRS); } } return super.createAsync(); }
Source:
private Mono<Void> handleFireAndForget(Payload payload) { Throwable err = checkAvailable(); if (err != null) { return Mono.error(err); } final int streamId = streamIdSupplier.nextStreamId(); ByteBuf requestFrame = RequestFireAndForgetFrameFlyweight.encode( allocator, streamId, false, payload.hasMetadata() ? payload.sliceMetadata().retain() : null, payload.sliceData().retain()); payload.release(); sendProcessor.onNext(requestFrame); return Mono.empty(); }

Target:
private Mono<Void> handleFireAndForget(Payload payload) { Throwable err = checkAvailable(); if (err != null) { payload.release(); return Mono.error(err); } final int streamId = streamIdSupplier.nextStreamId(); return emptyUnicastMono() .doOnSubscribe( new OnceConsumer<Subscription>() { @Override public void acceptOnce(@Nonnull Subscription subscription) { ByteBuf requestFrame = RequestFireAndForgetFrameFlyweight.encode( allocator, streamId, false, payload.hasMetadata() ? payload.sliceMetadata().retain() : null, payload.sliceData().retain()); payload.release(); sendProcessor.onNext(requestFrame); } }); }
Source:
private static int getPriority(final String severity) { int result = IMarker.PRIORITY_LOW; if ("blocker".equalsIgnoreCase(severity) || "critical".equalsIgnoreCase(severity)) { result = IMarker.PRIORITY_HIGH; } else if ("major".equalsIgnoreCase(severity)) { result = IMarker.PRIORITY_NORMAL; } else if ("minor".equalsIgnoreCase(severity) || "info".equalsIgnoreCase(severity)) { result = IMarker.PRIORITY_LOW; } return result; }

Target:
private static int getPriority(final String severity) { switch (severity.toLowerCase(Locale.ENGLISH)) { case "blocker": case "critical": return IMarker.PRIORITY_HIGH; case "major": return IMarker.PRIORITY_NORMAL; case "minor": case "info": default: return IMarker.PRIORITY_LOW; } }
Source:
String checkOutConnection() throws IOException { String connectionId = availableConnections.poll(); if (connectionId == null) { if (poolCount.incrementAndGet() <= maxConnectionsToHostPort) { connectionIdToPoolManager.put(selector .connect(new InetSocketAddress(host, port.getPort()), networkConfig.socketSendBufferBytes, networkConfig.socketReceiveBufferBytes, port.getPortType()), this); connectionIdCount++; } else { poolCount.decrementAndGet(); } } else { availableCount.decrementAndGet(); } return connectionId; }

Target:
String checkOutConnection() throws IOException { String connectionId = availableConnections.poll(); if (connectionId == null) { if (poolCount.incrementAndGet() <= maxConnectionsToHostPort) { connectionIdToPoolManager.put(selector .connect(new InetSocketAddress(host, port.getPort()), networkConfig.socketSendBufferBytes, networkConfig.socketReceiveBufferBytes, port.getPortType()), this); totalManagedConnectionsCount++; } else { poolCount.decrementAndGet(); } } else { availableCount.decrementAndGet(); } return connectionId; }
Source:
public Map<SystemStreamPartition, String> getOffsetsAfter(Map<SystemStreamPartition, String> offsets) { return new HashMap<>(); }

Target:
public Map<SystemStreamPartition, String> getOffsetsAfter(Map<SystemStreamPartition, String> offsets) { throw new UnsupportedOperationException("getOffsetsAfter not supported for AzureBlobSystemAdmin"); }
Source:
public Map<String, Criterion> getKilledByTeamMappings() { return killedByTeamMappings; }

Target:
public Map<String, Criterion> getKilledByTeamMappings() { return this.killedByTeamMappings; }
Source:
public List<String> getNames() { if (canAttackerRetreat() || canAttackerRetreatSeaPlanes() || (battleState.isAmphibious() && (canAttackerRetreatPartialAmphib() || canAttackerRetreatAmphibPlanes()))) { return List.of(battleState.getAttacker().getName() + ATTACKER_WITHDRAW); } return List.of(); }

Target:
public List<String> getNames() { return isRetreatPossible() ? List.of(battleState.getAttacker().getName() + ATTACKER_WITHDRAW) : List.of(); }
Source:
public static Map<String, byte[]> mapOfSerializableToByteArray(Map<String, Serializable> input) throws IOException { if (input == null) { return null; } HashMap<String, byte[]> answer = new HashMap<>(input.size()); for (Map.Entry<String, Serializable> entry : input.entrySet()) { answer.put(entry.getKey(), ObjectToByteConverter.ObjectStream.convert(entry.getValue())); } return answer; }

Target:
public static Map<String, byte[]> mapOfSerializableToByteArray(Map<String, Serializable> input) { if (input == null) { return null; } HashMap<String, byte[]> answer = new HashMap<>(input.size()); input.forEach((key, value) -> { try { answer.put(key, ObjectToByteConverter.ObjectStream.convert(value)); } catch (IOException e) { throw new RuntimeException("Error when converting variables to byte array ", e); } }); return answer; }
Source:
private StoredCacheData readCacheData(File conf) throws IgniteCheckedException { try (InputStream stream = new BufferedInputStream(new FileInputStream(conf))) { return marshaller.unmarshal(stream, U.resolveClassLoader(igniteCfg)); } catch (IOException e) { throw new IgniteCheckedException("Failed to read cache configuration from disk for cache: " + conf.getAbsolutePath(), e); } catch (IgniteCheckedException e) { if (e.getCause() != null && e.getCause() instanceof ClassNotFoundException) throw new IgniteCheckedException("During cache configuration loading from given file occurred error. " + "Make sure that user library containing required class is valid. " + "If library is valid then delete cache configuration file and restart cache [file=" + conf.getAbsolutePath() + ']', e); else throw e; } }

Target:
private StoredCacheData readCacheData(File conf) throws IgniteCheckedException { try (InputStream stream = new BufferedInputStream(new FileInputStream(conf))) { return marshaller.unmarshal(stream, U.resolveClassLoader(igniteCfg)); } catch (IOException e) { throw new IgniteCheckedException("Failed to read cache configuration from disk for cache: " + conf.getAbsolutePath(), e); } catch (IgniteCheckedException e) { if (e.hasCause(ClassNotFoundException.class)) throw new IgniteCheckedException("An error occurred during cache configuration loading from file [file=" + conf.getAbsolutePath() + "]. You may want to remove the configuration file; cache will be running " + "after next node start if static Ignite Configuration contains correct configuration of this cache. " + "If it was started dynamically, you may need to start it again (all data will be present).", e); else throw e; } }
Source:
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { logger.entering(new Object[] { method, testResult }); try { if (ListenerManager.isCurrentMethodSkipped(this)) { logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG); return; } Class<?> cls = method.getTestMethod().getInstance().getClass(); final boolean isWebTestClass = cls.getAnnotation(WebTest.class) != null; final boolean isMobileTestClass = cls.getAnnotation(MobileTest.class) != null; final boolean isSeLionAnnotatedTestClass = isMobileTestClass || isWebTestClass; if (!method.isTestMethod() && !isSeLionAnnotatedTestClass) { return; } if (isSeLionAnnotatedTestClass) { if (!isValidBeforeCondition(method)) { return; } if (method.isTestMethod()) { if (isLowPriority(method)) { testSessionSharingRules(method); } else { return; } } } if (Grid.getTestSession() != null) { return; } AbstractTestSession testSession = TestSessionFactory.newInstance(method); Grid.getThreadLocalTestSession().set(testSession); InvokedMethodInformation methodInfo = TestNGUtils.getInvokedMethodInformation(method, testResult); testSession.initializeTestSession(methodInfo); if (!(testSession instanceof BasicTestSession)) { try { LocalGridManager.spawnLocalHub(testSession); } catch (NoClassDefFoundError e) { logger.log(Level.SEVERE, "You are trying to run a local server but are missing Jars. Do you have " + "SeLion-Grid and Selenium-Server in your CLASSPATH?", e); System.exit(1); } } } catch (Exception e) { logger.log(Level.WARNING, "An error occurred while processing beforeInvocation: " + e.getMessage(), e); } logger.exiting(); }

Target:
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { logger.entering(new Object[] { method, testResult }); try { if (ListenerManager.isCurrentMethodSkipped(this)) { logger.exiting(ListenerManager.THREAD_EXCLUSION_MSG); return; } if (!method.isTestMethod() && !isSeLionAnnotatedTestClass(method)) { return; } if (isSeLionAnnotatedTestClass(method)) { if (!isValidBeforeCondition(method)) { return; } if (method.isTestMethod()) { if (isLowPriority(method)) { testSessionSharingRules(method); } else { return; } } } if (Grid.getTestSession() != null) { return; } AbstractTestSession testSession = TestSessionFactory.newInstance(method); Grid.getThreadLocalTestSession().set(testSession); InvokedMethodInformation methodInfo = TestNGUtils.getInvokedMethodInformation(method, testResult); testSession.initializeTestSession(methodInfo); if (!(testSession instanceof BasicTestSession)) { try { LocalGridManager.spawnLocalHub(testSession); } catch (NoClassDefFoundError e) { logger.log(Level.SEVERE, "You are trying to run a local server but are missing Jars. Do you have " + "SeLion-Grid and Selenium-Server in your CLASSPATH?", e); System.exit(1); } } } catch (Exception e) { logger.log(Level.WARNING, "An error occurred while processing beforeInvocation: " + e.getMessage(), e); } logger.exiting(); }
Source:
public void run() { int timeout = Integer.MAX_VALUE; int expired = 0; try { timeout = ConfigParser.parse().getInt("nodeRecycleThreadWaitTimeout"); } catch (ConfigParserException e) { } appendMsgToCustomLog("Started NodeRecycleThread to restart the node once all the sessions are completed."); while ((getTotalUsed() > 0) && (expired < timeout)) { try { Thread.sleep(1000); expired += 1; } catch (InterruptedException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } if (expired >= timeout) { appendMsgToCustomLog("Timeout occurred while waiting for sessions to complete. Forcefully restarting the" + " node."); } else { appendMsgToCustomLog("All sessions are completed and restarting the node."); } shutdownNode(); }

Target:
public void run() { LOGGER.entering(); running = true; int timeout = 0; int expired = 0; try { timeout = ConfigParser.parse().getInt("nodeRecycleThreadWaitTimeout"); } catch (ConfigParserException e) { } proxyLogger.fine("Started NodeRecycleThread with " + ((timeout == 0) ? "no" : "a " + timeout + " second") + " timeout for node " + nodeId); while (keepLooping(expired, timeout)) { try { sleep(1000); expired += 1; } catch (InterruptedException e) { if (running) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } running = false; proxyLogger.warning("NodeRecycleThread was interrupted."); LOGGER.exiting(); return; } } if (wasExpired(expired, timeout)) { proxyLogger.info("Timeout occurred while waiting for sessions to complete. Shutting down the node."); } else { proxyLogger.info("All sessions are complete. Shutting down the node."); } forceNodeShutdown(); LOGGER.exiting(); }
Source:
public JcloudsSshMachineLocation obtain(Map<?,?> flags) throws NoMachinesAvailableException { ConfigBag setup = ConfigBag.newInstanceExtending(getConfigBag(), flags); Integer attempts = setup.get(MACHINE_CREATE_ATTEMPTS); if (attempts == null || attempts < 1) attempts = 1; for (int i = 0; i < attempts; i++) { try { return obtainImpl(flags, setup); } catch (PropagatedRuntimeException e) { LOG.warn("Attempt #{}/{} to obtain machine threw error: {}", new Object[]{i, attempts, e}); } } LOG.error("Failed to get VM after attempts.", attempts); throw new NoMachinesAvailableException("Failed to get VM after "+attempts+" attempts. See logs."); }

Target:
public JcloudsSshMachineLocation obtain(Map<?,?> flags) throws NoMachinesAvailableException { ConfigBag setup = ConfigBag.newInstanceExtending(getConfigBag(), flags); Integer attempts = setup.get(MACHINE_CREATE_ATTEMPTS); Exception lastThrownException = null; if (attempts == null || attempts < 1) attempts = 1; for (int i = 1; i <= attempts; i++) { try { return obtainOnce(flags, setup); } catch (RuntimeException e) { LOG.warn("Attempt #{}/{} to obtain machine threw error: {}", new Object[]{i, attempts, e}); lastThrownException = e; } } throw new NoMachinesAvailableException( String.format("Failed to get VM after %d attempt%s.", attempts, attempts == 1 ? "" : "s"), lastThrownException); }
Source:
public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); try { final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSeparatorWrapAfter3904.java"), expected); fail("exception expected"); } catch (CheckstyleException ex) { assertTrue(ex.getMessage().startsWith( "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - " + "Cannot set property 'option' to 'invalid_option' in module")); } }

Target:
public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); try { final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSeparatorWrapForInvalidOption.java"), expected); fail("exception expected"); } catch (CheckstyleException ex) { assertTrue(ex.getMessage().startsWith( "cannot initialize module com.puppycrawl.tools.checkstyle.TreeWalker - " + "Cannot set property 'option' to 'invalid_option' in module")); } }
Source:
protected void testExecute_nonExistentCourse_shouldFail() { StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1"); ______TS("course does not exist"); String[] nonExistingParams = new String[] { Const.ParamsNames.STUDENT_EMAIL, student1InCourse1.email, Const.ParamsNames.COURSE_ID, "non-existent-course", }; RegenerateStudentCourseLinksAction a = getAction(nonExistingParams); JsonResult result = getJsonResult(a); MessageOutput output = (MessageOutput) result.getOutput(); assertEquals(String.format(RegenerateStudentCourseLinksAction.STUDENT_NOT_FOUND, student1InCourse1.email, "non-existent-course"), output.getMessage()); assertEquals(HttpStatus.SC_NOT_FOUND, result.getStatusCode()); }

Target:
protected void testExecute_nonExistentCourse_shouldFail() { StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1"); ______TS("course does not exist"); String[] nonExistingParams = new String[] { Const.ParamsNames.STUDENT_EMAIL, student1InCourse1.email, Const.ParamsNames.COURSE_ID, "non-existent-course", }; assertNull(logic.getCourse("non-existent-course")); RegenerateStudentCourseLinksAction a = getAction(nonExistingParams); JsonResult result = getJsonResult(a); MessageOutput output = (MessageOutput) result.getOutput(); assertEquals(String.format(RegenerateStudentCourseLinksAction.STUDENT_NOT_FOUND, student1InCourse1.email, "non-existent-course"), output.getMessage()); assertEquals(HttpStatus.SC_NOT_FOUND, result.getStatusCode()); }
Source:
public static String join(String base, String... segments) { StringBuilder pathBuilder = new StringBuilder(); if (base != null && !base.isEmpty()) { if (base.charAt(base.length() - 1) == '/') { pathBuilder.append(base.substring(0, base.length() - 1)); } else { pathBuilder.append(base); } } if (segments[0] != null) { for (String segment : segments) { if (segment.charAt(0) != '/' && pathBuilder.length() > 0) { pathBuilder.append('/'); } if (segment.charAt(segment.length() - 1) == '/') { pathBuilder.append(segment.substring(0, segment.length() - 1)); } else { pathBuilder.append(segment); } } } return pathBuilder.toString(); }

Target:
public static String join(String base, String... segments) { StringBuilder pathBuilder = new StringBuilder(); if (base != null && !base.isEmpty()) { if (base.charAt(base.length() - 1) == '/') { pathBuilder.append(base.substring(0, base.length() - 1)); } else { pathBuilder.append(base); } } int i = 0; for (String segment : segments) { i++; if (segments[i - 1] == null) { continue; } if (segment.charAt(0) != '/' && pathBuilder.length() > 0) { pathBuilder.append('/'); } if (segment.charAt(segment.length() - 1) == '/') { pathBuilder.append(segment.substring(0, segment.length() - 1)); } else { pathBuilder.append(segment); } } return pathBuilder.toString(); }
Source:
private String getOperatorName(final String operatorCode) { final int boundary = operatorCode.length() -3; final String mnc = operatorCode.substring(boundary, operatorCode.length()); final String mcc = operatorCode.substring(0, boundary); return OPERATOR_MAP.get(mcc).get(mnc).getOperator(); }

Target:
private String getOperatorName(final String operatorCode) { if (null != operatorCode && operatorCode.length() >= 5) { final String mnc = operatorCode.substring(3, operatorCode.length()); final String mcc = operatorCode.substring(0, 3); Map<String, MccMncRecord> country = OPERATOR_MAP.get(mcc); if (null != country) { MccMncRecord match = country.get(mnc); if (null != match) { return match.getOperator(); } } } return null; }
Source:
private void clearWorkerMetrics() { synchronized (workerEvalMiniBatchParams) { workerEvalMiniBatchParams.clear(); } }

Target:
private void clearWorkerMetrics() { synchronized (workerEvalMiniBatchParams) { workerEvalMiniBatchParams.clear(); } synchronized (workerEvalEpochParams) { workerEvalEpochParams.clear(); } }
Source:
public static long getEntityId(String requestURL) { Matcher matcher = ENTITY_PATTERN.matcher(requestURL); if (!matcher.find()) { return -1L; } String entityId = matcher.group(1); if (entityId.toLowerCase().startsWith("syn")) { entityId = entityId.substring(3); } return Long.parseLong(entityId); }

Target:
public static Long getEntityId(String requestURL) { requestURL = requestURL.toLowerCase(); Matcher matcher = ENTITY_PATTERN.matcher(requestURL); if (!matcher.find()) { return null; } String entityId = matcher.group(1); if (entityId.startsWith("syn")) { entityId = entityId.substring(3); } return Long.parseLong(entityId); }
Source:
public static StoragePool getStoragePool(Cluster cluster, AbstractBackendResource parent) { StoragePool pool = null; if (cluster.getDataCenter().isSetId()) { String id = cluster.getDataCenter().getId(); pool = parent.getEntity(StoragePool.class, VdcQueryType.GetStoragePoolById, new IdQueryParameters(new Guid(id)), "Datacenter: id=" + id); } else { pool = parent.getEntity(StoragePool.class, VdcQueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(cluster.getDataCenter().getName()), "Datacenter: name=" + cluster.getDataCenter().getName()); cluster.getDataCenter().setId(pool.getId().toString()); } return pool; }

Target:
public static StoragePool getStoragePool(Cluster cluster, AbstractBackendResource parent) { StoragePool pool = null; if (cluster.getDataCenter().isSetId()) { String id = cluster.getDataCenter().getId(); pool = parent.getEntity(StoragePool.class, VdcQueryType.GetStoragePoolById, new IdQueryParameters(new Guid(id)), "Datacenter: id=" + id); } else { String clusterName = cluster.getDataCenter().getName(); pool = parent.getEntity(StoragePool.class, VdcQueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(clusterName), "Datacenter: name=" + clusterName); cluster.getDataCenter().setId(pool.getId().toString()); } return pool; }
Source:
protected void addCNature(IProject project, IProgressMonitor monitor, boolean addMakeBuilder) throws CoreException { if (getWizard() instanceof ConversionWizard) { ConversionWizard cw = (ConversionWizard) getWizard(); if (cw.getBuildSystemId() != null) { CCorePlugin.getDefault().convertProjectToNewC(project, cw.getBuildSystemId(), monitor); } else { CCorePlugin.getDefault().convertProjectToC(project, monitor, cw.getProjectID()); } } }

Target:
protected void addCNature(IProject project, IProgressMonitor monitor, boolean addMakeBuilder) throws CoreException { if (getWizard() instanceof ConversionWizard) { ConversionWizard cw = (ConversionWizard) getWizard(); if (cw.getBuildSystemId() != null) CCorePlugin.getDefault().convertProjectToNewC(project, cw.getBuildSystemId(), monitor); else CCorePlugin.getDefault().convertProjectToC(project, monitor, cw.getProjectID()); } }
Source:
public String toJson() { GSonData gd = new GSonData(); gd.candidates = candidates; return GSON.toJson(gd).replaceAll(" ", " "); }

Target:
public String toJson() { GSonData gd = new GSonData(); gd.candidates = candidates; return GSON.toJson(gd); }
Source:
private void ensureCapacity(long writeSize) throws IOException { if (segmentsByName.higherEntry(activeSegment.getName()) != null) { return; } long segmentCapacity = activeSegment.getCapacityInBytes(); if (segmentCapacity > remainingUnallocatedCapacity.get()) { metrics.overflowWriteError.inc(); throw new IllegalStateException( "There is no more capacity left in [" + dataDir + "]. Max capacity is [" + capacityInBytes + "]"); } if (writeSize > segmentCapacity - LogSegment.HEADER_SIZE) { metrics.overflowWriteError.inc(); throw new IllegalArgumentException("Write of size [" + writeSize + "] cannot be serviced because it is greater " + "than a single segment's capacity [" + (segmentCapacity - LogSegment.HEADER_SIZE) + "]"); } String lastSegmentName = segmentsByName.lastEntry().getKey(); String newSegmentName = LogSegmentNameHelper.getNextPositionName(lastSegmentName); File newSegmentFile = allocate(LogSegmentNameHelper.nameToFilename(newSegmentName), segmentCapacity); LogSegment newSegment = new LogSegment(newSegmentName, newSegmentFile, segmentCapacity, metrics, true); segmentsByName.put(newSegmentName, newSegment); }

Target:
private void ensureCapacity(long writeSize) throws IOException { if (remainingUnallocatedSegments == 0) { metrics.overflowWriteError.inc(); throw new IllegalStateException( "There is no more capacity left in [" + dataDir + "]. Max capacity is [" + capacityInBytes + "]"); } long segmentCapacity = activeSegment.getCapacityInBytes(); if (writeSize > segmentCapacity - LogSegment.HEADER_SIZE) { metrics.overflowWriteError.inc(); throw new IllegalArgumentException("Write of size [" + writeSize + "] cannot be serviced because it is greater " + "than a single segment's capacity [" + (segmentCapacity - LogSegment.HEADER_SIZE) + "]"); } String newSegmentName = LogSegmentNameHelper.getNextPositionName(activeSegment.getName()); logger.info("Allocating new segment with name: " + newSegmentName); File newSegmentFile = allocate(LogSegmentNameHelper.nameToFilename(newSegmentName), segmentCapacity); LogSegment newSegment = new LogSegment(newSegmentName, newSegmentFile, segmentCapacity, metrics, true); segmentsByName.put(newSegmentName, newSegment); }
Source:
public void add(RevCommit revCommit) { assert null != revCommit; checkWidget(); String shortSha1 = revCommit.getName().substring(0, 6); String message = shortSha1 + ": " + revCommit.getShortMessage(); combo.add(message); commits.add(new ComboCommitEnt(revCommit.getId(), message)); }

Target:
public void add(RevCommit revCommit) { Assert.isNotNull(revCommit); checkWidget(); String shortSha1 = revCommit.getName().substring(0, 6); String message = shortSha1 + ": " + revCommit.getShortMessage(); combo.add(message); commits.add(new ComboCommitEnt(revCommit.getId(), message)); }
Source:
public InternalFetchConnection(PackTransport transport, final UploadPackFactory<C> uploadPackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream() { { buffer = new byte[MIN_CLIENT_BUFFER]; } }; out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Upload-Pack") { @Override public void run() { try { final UploadPack rp = uploadPackFactory.create(req, remote); rp.upload(out_r, in_w, null); } catch (ServiceNotEnabledException | ServiceNotAuthorizedException e) { } catch (IOException err) { err.printStackTrace(); } catch (RuntimeException err) { err.printStackTrace(); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }

Target:
public InternalFetchConnection(PackTransport transport, final UploadPackFactory<C> uploadPackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream() { { buffer = new byte[MIN_CLIENT_BUFFER]; } }; out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Upload-Pack") { @Override public void run() { try { final UploadPack rp = uploadPackFactory.create(req, remote); rp.upload(out_r, in_w, null); } catch (ServiceNotEnabledException | ServiceNotAuthorizedException e) { } catch (IOException | RuntimeException err) { err.printStackTrace(); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }
Source:
public Map<String, DbParameterAccessor> getAllColumns( final String tableOrViewName) throws SQLException { String qry = "SELECT COLUMNNAME AS COLUMN_NAME, COLUMNDATATYPE AS TYPE_NAME, " + " ROW_NUMBER() OVER() AS ORDINAL_POSITION, " + + DatabaseMetaData.procedureColumnIn + " AS COLUMN_TYPE " + "FROM SYS.SYSCOLUMNS WHERE REFERENCEID = " + "(SELECT TABLEID FROM SYS.SYSTABLES WHERE TABLENAME = ?)"; return fetchIntoParams(tableOrViewName.toUpperCase(), qry); }

Target:
public Map<String, DbParameterAccessor> getAllColumns( final String tableOrViewName) throws SQLException { String qry = "SELECT COLUMNNAME AS COLUMN_NAME, COLUMNDATATYPE AS TYPE_NAME, " + " ROW_NUMBER() OVER() AS ORDINAL_POSITION, " + + DatabaseMetaData.procedureColumnIn + " AS COLUMN_TYPE " + "FROM SYS.SYSCOLUMNS WHERE REFERENCEID = " + "(SELECT TABLEID FROM SYS.SYSTABLES WHERE TABLENAME = ?)" + "ORDER BY COLUMNNUMBER"; return fetchIntoParams(tableOrViewName.toUpperCase(), qry); }
Source:
public void verifyEmbedMapCode(embedMapDialogButtons button) { switch (button) { case small: waitForElementVisibleByElement(embedMapCodeSmall); break; case medium: waitForElementVisibleByElement(embedMapCodeMedium); break; case large: waitForElementVisibleByElement(embedMapCodeLarge); break; } }

Target:
public void verifyEmbedMapCode(embedMapDialogButtons button) { switch (button) { case small: waitForElementVisibleByElement(embedMapCodeSmall); break; case medium: waitForElementVisibleByElement(embedMapCodeMedium); break; case large: waitForElementVisibleByElement(embedMapCodeLarge); break; } PageObjectLogging.log("verifyEmbedMapCode", button + "embed map code was correctly displayed", true); }
Source:
public ItemFile getItemFile(final ZipEntry zipEntry, final ZipFile zipFile) { Objects.requireNonNull(zipEntry, "A null ZIP entry was passed."); Objects.requireNonNull(zipFile, "A null ZIP file was passed."); return new ItemFile() { private ZipEntry itemEntry = zipEntry; private Image image = null; @Override public Object getItem() throws Exception { if (image == null) { image = createZippedImage(itemEntry, zipFile); } return ImageUtil.getScaledImage(image, getWidth(), getHeight()); } }; }

Target:
public ItemFile getItemFile(final ZipEntry zipEntry, final ZipFile zipFile) { Objects.requireNonNull(zipEntry, "A null ZIP entry was passed."); Objects.requireNonNull(zipFile, "A null ZIP file was passed."); return new ItemFile() { private ZipEntry itemEntry = zipEntry; private Image image = null; @Override public Object getItem() throws Exception { if (image == null) { image = ImageUtil.getScaledImage(createZippedImage(itemEntry, zipFile), getWidth(), getHeight()); } return image; } }; }
Source:
protected static String extractTestXml(File xmlFile, String category, String definitionName) throws IOException, FileNotFoundException { StringBuilder xmlPart = new StringBuilder(); boolean started = false; try (RandomAccessFile raf = new RandomAccessFile(xmlFile, "r");) { String s = raf.readLine(); while (s != null) { if (s.equals("<Definition category=\"" + category + "\" name=\"" + definitionName + "\">")) { started = true; } if (started) { if (s.equals("</Definition>")) { break; } xmlPart.append(s); xmlPart.append('\n'); } s = raf.readLine(); } } return xmlPart.toString(); }

Target:
protected static String extractTestXml(File xmlFile, String category, String definitionName) throws IOException, FileNotFoundException { StringBuilder xmlPart = new StringBuilder(); boolean started = false; try (BufferedRandomAccessFile raf = new BufferedRandomAccessFile(xmlFile, "r");) { String s = raf.readLine(); while (s != null) { if (s.equals("<Definition category=\"" + category + "\" name=\"" + definitionName + "\">")) { started = true; } if (started) { if (s.equals("</Definition>")) { break; } xmlPart.append(s); xmlPart.append('\n'); } s = raf.readLine(); } } return xmlPart.toString(); }
Source:
private void sendLargeFile(AbstractJournalStorageManager.JournalContent content, SimpleString pageStore, final long id, SequentialFile file, long maxBytesToSend) throws Exception { if (!enabled) return; if (!file.isOpen()) { file.open(); } final int size = 1024 * 1024; long fileSize = file.size(); int flowControlSize = 10; int packetsSent = 0; FlushAction action = new FlushAction(); long offset = 0; RandomAccessFile raf; FileChannel fileChannel = null; try { raf = new RandomAccessFile(file.getJavaFile(), "r"); fileChannel = raf.getChannel(); while (true) { long chunkSize = Math.min(size, fileSize - offset); int toSend = (int) chunkSize; if (chunkSize > 0) { if (chunkSize >= maxBytesToSend) { toSend = (int) maxBytesToSend; maxBytesToSend = 0; } else { maxBytesToSend = maxBytesToSend - chunkSize; } } logger.debug("sending " + toSend + " bytes on file " + file.getFileName()); sendSyncFileMessage(new ReplicationSyncFileMessage(content, pageStore, id, raf, fileChannel, offset, toSend), offset + toSend == fileSize); packetsSent++; offset += toSend; if (packetsSent % flowControlSize == 0) { flushReplicationStream(action); } if (toSend == 0 || maxBytesToSend == 0) break; } flushReplicationStream(action); } catch (Exception e) { if (fileChannel != null) fileChannel.close(); throw e; } finally { if (file.isOpen()) file.close(); } }

Target:
private void sendLargeFile(AbstractJournalStorageManager.JournalContent content, SimpleString pageStore, final long id, SequentialFile file, long maxBytesToSend) throws Exception { if (!enabled) return; if (!file.isOpen()) { file.open(); } final int size = 1024 * 1024; long fileSize = file.size(); int flowControlSize = 10; int packetsSent = 0; FlushAction action = new FlushAction(); long offset = 0; RandomAccessFile raf = null; FileChannel fileChannel = null; try { raf = new RandomAccessFile(file.getJavaFile(), "r"); fileChannel = raf.getChannel(); while (true) { long chunkSize = Math.min(size, fileSize - offset); int toSend = (int) chunkSize; if (chunkSize > 0) { if (chunkSize >= maxBytesToSend) { toSend = (int) maxBytesToSend; maxBytesToSend = 0; } else { maxBytesToSend = maxBytesToSend - chunkSize; } } logger.debug("sending " + toSend + " bytes on file " + file.getFileName()); sendSyncFileMessage(new ReplicationSyncFileMessage(content, pageStore, id, raf, fileChannel, offset, toSend), offset + toSend == fileSize); packetsSent++; offset += toSend; if (packetsSent % flowControlSize == 0) { flushReplicationStream(action); } if (toSend == 0 || maxBytesToSend == 0) break; } flushReplicationStream(action); } catch (Exception e) { if (raf != null) raf.close(); throw e; } finally { if (file.isOpen()) file.close(); } }
Source:
public int[] getSceneValue(String token, DSID dSID, String dSUID, String name, Short sceneId) { int[] value = { -1, -1 }; if (checkRequiredDevice(dSID, dSUID, name)) { try { String response = transport.execute(SimpleRequestBuilder.buildNewRequest(InterfaceKeys.JSON) .addRequestClass(ClassKeys.DEVICE).addFunction(FunctionKeys.GET_SCENE_VALUE) .addParameter(ParameterKeys.SCENE_ID, convertShortToString(sceneId)) .addParameter(ParameterKeys.DSID, getDsidString(dSID)).addParameter(ParameterKeys.DSUID, dSUID) .addParameter(ParameterKeys.NAME, name).addParameter(ParameterKeys.TOKEN, token) .buildRequestString(), 4000, 20000); JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject obj = JSONResponseHandler.getResultJsonObject(responseObj); if (obj != null && obj.get("value") != null) { value[0] = obj.get("value").getAsInt(); if (obj.get("angle") != null) { value[1] = obj.get("angle").getAsInt(); } return value; } } } catch (Exception e) { logger.debug("An exception occurred", e); } } return value; }

Target:
public int[] getSceneValue(String token, DSID dSID, String dSUID, String name, Short sceneId) { int[] value = { -1, -1 }; if (checkRequiredDevice(dSID, dSUID, name)) { String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.DEVICE) .addFunction(FunctionKeys.GET_SCENE_VALUE).addDefaultDeviceParameter(token, dSID, dSUID, name) .addParameter(ParameterKeys.SCENE_ID, SimpleRequestBuilder.objectToString(sceneId)) .buildRequestString(), Config.DEFAULT_CONNECTION_TIMEOUT, Config.HIGH_READ_TIMEOUT); JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject obj = JSONResponseHandler.getResultJsonObject(responseObj); if (obj != null && obj.get(JSONApiResponseKeysEnum.VALUE.getKey()) != null) { value[GeneralLibConstance.SCENE_ARRAY_INDEX_VALUE] = obj.get(JSONApiResponseKeysEnum.VALUE.getKey()) .getAsInt(); if (obj.get(JSONApiResponseKeysEnum.ANGLE.getKey()) != null) { value[GeneralLibConstance.SCENE_ARRAY_INDEX_ANGLE] = obj .get(JSONApiResponseKeysEnum.ANGLE.getKey()).getAsInt(); } return value; } } } return value; }
Source:
public void stop() { if (System.getenv("ZEPPELIN_FORCE_STOP") != null) { if (isRunning()) { logger.info("Kill interpreter process"); try { callRemoteFunction(new RemoteFunction<Void>() { @Override public Void call(RemoteInterpreterService.Client client) throws Exception { client.shutdown(); return null; } }); } catch (Exception e) { logger.warn("ignore the exception when shutting down"); } } } }

Target:
public void stop() { if (System.getenv("ZEPPELIN_FORCE_STOP") != null) { if (isRunning()) { logger.info("Kill interpreter process"); try { callRemoteFunction(new RemoteFunction<Void>() { @Override public Void call(RemoteInterpreterService.Client client) throws Exception { client.shutdown(); return null; } }); } catch (Exception e) { logger.warn("ignore the exception when shutting down interpreter process.", e); } } } }