auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; String networkName = ""; List<VnicProfileProperties> unsupportedFeatures = new ArrayList<>(); if (nic.getVnicProfileId() != null) { vnicProfile = vnicProfileDao.get(nic.getVnicProfileId()); if (vnicProfile != null) { network = networkDao.get(vnicProfile.getNetworkId()); networkName = network.getVdsmName(); log.debug("VNIC '{}' is using profile '{}' on network '{}'", nic.getName(), vnicProfile, networkName); addQosForDevice(struct, vnicProfile); } } struct.put(VdsProperties.NETWORK, networkName); addPortMirroringToVmInterface(struct, vnicProfile, network); addCustomPropertiesForDevice(struct, vm, vmDevice, getVnicCustomProperties(vnicProfile)); reportUnsupportedVnicProfileFeatures(vm, nic, vnicProfile, unsupportedFeatures); }

Target:
public void addProfileDataToNic(Map<String, Object> struct, VM vm, VmDevice vmDevice, VmNic nic) { VnicProfile vnicProfile = null; Network network = null; String networkName = ""; String vdsmName = ""; List<VnicProfileProperties> unsupportedFeatures = new ArrayList<>(); if (nic.getVnicProfileId() != null) { vnicProfile = vnicProfileDao.get(nic.getVnicProfileId()); if (vnicProfile != null) { network = networkDao.get(vnicProfile.getNetworkId()); networkName = network.getName(); vdsmName = network.getVdsmName(); log.debug("VNIC '{}' is using profile '{}' on network '{}' with vdsmName '{}'", nic.getName(), vnicProfile, networkName, vdsmName); addQosForDevice(struct, vnicProfile); } } struct.put(VdsProperties.NETWORK, vdsmName); addPortMirroringToVmInterface(struct, vnicProfile, network); addCustomPropertiesForDevice(struct, vm, vmDevice, getVnicCustomProperties(vnicProfile)); reportUnsupportedVnicProfileFeatures(vm, nic, vnicProfile, unsupportedFeatures); }
Source:
public Long saveOrUpdate(PositionDTO position) { Assert.notNull(position); Assert.notNull(position.getName()); PositionEntity positionEntity = this.positionRepository.findByName(position.getName()); if (positionEntity == null) { positionEntity = this.converterService.convert(position, PositionEntity.class); } else if (positionEntity.isDeleted() != null && positionEntity.isDeleted()) { positionEntity.setDeleted(false); } else { throw new DuplicatePositionException(position.getName()); } try { return this.positionRepository.saveAndFlush(positionEntity).getId(); } catch (NullPointerException e) { return -1L; } }

Target:
public Long saveOrUpdate(PositionDTO position) { Assert.notNull(position); Assert.notNull(position.getName()); PositionEntity positionEntity = this.positionRepository.findByName(position.getName()); if (positionEntity == null) { positionEntity = this.converterService.convert(position, PositionEntity.class); } else if (positionEntity.isDeleted() != null && positionEntity.isDeleted()) { positionEntity.setDeleted(false); } else { throw new DuplicatePositionException(position.getName()); } this.positionRepository.saveAndFlush(positionEntity); return positionEntity.getId(); }
Source:
public boolean addTag(final String tag) { checkNotNull(tag); if (this.tags.size() >= 1024) { return false; } return this.tags.add(tag); }

Target:
public boolean entity$addTag(final String tag) { return this.shadow$addTag(tag); }
Source:
public Database() { mDatabaseDrivers = new ArrayList<>(); mChromePeerManager = new ChromePeerManager(); mChromePeerManager.setListener(new PeerRegistrationListener() { @Override public void onPeerRegistered(JsonRpcPeer peer) { for (DatabaseDriver databaseDriver : mDatabaseDrivers) { databaseDriver.onRegistered(peer); } } @Override public void onPeerUnregistered(JsonRpcPeer peer) { for (DatabaseDriver databaseDriver : mDatabaseDrivers) { databaseDriver.onUnregistered(peer); } } }); mObjectMapper = new ObjectMapper(); }

Target:
public Database() { mDatabaseDrivers = new ArrayList<>(); mChromePeerManager = new ChromePeerManager(); mPeerListener = new DatabasePeerRegistrationListener(mDatabaseDrivers); mChromePeerManager.setListener(mPeerListener); mObjectMapper = new ObjectMapper(); }
Source:
void noNameIfNotWater() { when(battleSite.isWater()).thenReturn(false); final BattleState battleState = givenBattleStateBuilder().battleSite(battleSite).build(); final RemoveUnprotectedUnits removeUnprotectedUnits = new RemoveUnprotectedUnits(battleState, battleActions); assertThat(removeUnprotectedUnits.getNames(), hasSize(0)); }

Target:
void noNameIfNotWater() { when(battleSite.isWater()).thenReturn(false); final BattleState battleState = givenBattleStateBuilder().battleSite(battleSite).build(); final RemoveUnprotectedUnits removeUnprotectedUnits = new RemoveUnprotectedUnits(battleState, battleActions); assertThat(removeUnprotectedUnits.getNames(), is(empty())); }
Source:
synchronized void requestPage() { AtomicBoolean receivedPages = new AtomicBoolean(false); pageRetriever.get(continuationState.getLastContinuationToken(), defaultPageSize) .map(page -> { receivedPages.set(true); addPage(page); continuationState.setLastContinuationToken(page.getContinuationToken()); this.done = continuationState.isDone(); return page; }) .then() .block(); this.done = done || (!receivedPages.get() && !isNextAvailable()); }

Target:
synchronized void requestPage() { if (isNextAvailable() || done) { return; } AtomicBoolean receivedPages = new AtomicBoolean(false); pageRetriever.get(continuationState.getLastContinuationToken(), defaultPageSize) .map(page -> { receivedPages.set(true); addPage(page); continuationState.setLastContinuationToken(page.getContinuationToken()); this.done = continuationState.isDone(); return page; }).blockLast(); this.done = done || (!receivedPages.get() && !isNextAvailable()); }
Source:
private void guessParameters() throws Exception { int count = fParametersNames.length; fPositions = new Position[count]; fChoices = new ICompletionProposal[count][]; ParameterGuesser guesser = new ParameterGuesser(); for (int i = 0; i < count; i++) { String paramName = new String(fParametersNames[i]); Position position = new Position(0, 0); boolean isLastParameter = i == count - 1; ArrayList<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>(); ICompletionProposal[] argumentProposals = guesser.parameterProposals(fParametersTypes[i], paramName, position, fAssignableElements, isLastParameter); allProposals.addAll(Arrays.asList(argumentProposals)); fPositions[i] = position; fChoices[i] = argumentProposals; } updateProposalsPossitions(); }

Target:
private void guessParameters() throws Exception { int count = fParametersNames.length; fPositions = new Position[count]; fChoices = new ICompletionProposal[count][]; ParameterGuesser guesser = new ParameterGuesser(); for (int i = 0; i < count; i++) { String paramName = new String(fParametersNames[i]); Position position = new Position(0, 0); boolean isLastParameter = i == count - 1; ArrayList<ICompletionProposal> allProposals = new ArrayList<>(); ICompletionProposal[] argumentProposals = guesser.parameterProposals(fParametersTypes[i], paramName, position, fAssignableElements, isLastParameter); allProposals.addAll(Arrays.asList(argumentProposals)); fPositions[i] = position; fChoices[i] = argumentProposals; } updateProposalsPossitions(); }
Source:
public void tryPush(int maxAttempts) throws IOException { int numConnectAttempts = 0; do { try { Socket pushSocket = new Socket(m_server, m_port); OutputStream socketStream = pushSocket.getOutputStream(); System.out.printf("Connected to VoltDB socket importer at: %s.\n", m_server + ":" + m_port); String s = String.valueOf(m_counter) + m_separator + System.currentTimeMillis() + "\n"; socketStream.write(s.getBytes()); pushSocket.close(); return; } catch (IOException e) { numConnectAttempts++; if (numConnectAttempts < maxAttempts) { throw e; } try { Thread.sleep((int) (Math.random() * 1000) + 500); } catch (InterruptedException ignore) { } } } while (true); }

Target:
public void tryPush(int maxAttempts) throws IOException { int numConnectAttempts = 0; do { try { Socket pushSocket = new Socket(m_server, m_port); OutputStream socketStream = pushSocket.getOutputStream(); System.out.printf("Connected to VoltDB socket importer at: %s.\n", m_server + ":" + m_port); String s = String.valueOf(m_counter) + m_separator + System.currentTimeMillis() + "\n"; socketStream.write(s.getBytes()); pushSocket.close(); m_counter++; return; } catch (IOException e) { numConnectAttempts++; if (numConnectAttempts >= maxAttempts) { throw e; } try { Thread.sleep((int) (Math.random() * 1000) + 500); } catch (InterruptedException ignore) { } } } while (true); }
Source:
static public Map<String, String> generateSerdeConfig(List<TableDescriptor> tableDescriptors) { Map<String, String> serdeConfigs = new HashMap<>(); Map<String, Serde> tableKeySerdes = new HashMap<>(); Map<String, Serde> tableValueSerdes = new HashMap<>(); HashSet<Serde> serdes = new HashSet<>(); tableDescriptors.stream() .filter(d -> d instanceof LocalTableDescriptor) .forEach(d -> { LocalTableDescriptor ld = (LocalTableDescriptor) d; tableKeySerdes.put(ld.getTableId(), ld.getSerde().getKeySerde()); tableValueSerdes.put(ld.getTableId(), ld.getSerde().getValueSerde()); }); serdes.addAll(tableKeySerdes.values()); serdes.addAll(tableValueSerdes.values()); SerializableSerde<Serde> serializableSerde = new SerializableSerde<>(); Base64.Encoder base64Encoder = Base64.getEncoder(); Map<Serde, String> serdeUUIDs = new HashMap<>(); serdes.forEach(serde -> { String serdeName = serdeUUIDs.computeIfAbsent(serde, s -> serde.getClass().getSimpleName() + "-" + UUID.randomUUID().toString()); serdeConfigs.putIfAbsent(String.format(SerializerConfig.SERDE_SERIALIZED_INSTANCE(), serdeName), base64Encoder.encodeToString(serializableSerde.toBytes(serde))); }); tableKeySerdes.forEach((tableId, serde) -> { String keySerdeConfigKey = String.format(JavaTableConfig.STORE_KEY_SERDE, tableId); serdeConfigs.put(keySerdeConfigKey, serdeUUIDs.get(serde)); }); tableValueSerdes.forEach((tableId, serde) -> { String valueSerdeConfigKey = String.format(JavaTableConfig.STORE_MSG_SERDE, tableId); serdeConfigs.put(valueSerdeConfigKey, serdeUUIDs.get(serde)); }); return serdeConfigs; }

Target:
public static Map<String, String> generateSerdeConfig(List<TableDescriptor> tableDescriptors) { Map<String, String> serdeConfigs = new HashMap<>(); Map<String, Serde> tableKeySerdes = new HashMap<>(); Map<String, Serde> tableValueSerdes = new HashMap<>(); HashSet<Serde> serdes = new HashSet<>(); tableDescriptors.stream() .filter(d -> d instanceof LocalTableDescriptor) .forEach(d -> { LocalTableDescriptor ld = (LocalTableDescriptor) d; tableKeySerdes.put(ld.getTableId(), ld.getSerde().getKeySerde()); tableValueSerdes.put(ld.getTableId(), ld.getSerde().getValueSerde()); }); serdes.addAll(tableKeySerdes.values()); serdes.addAll(tableValueSerdes.values()); SerializableSerde<Serde> serializableSerde = new SerializableSerde<>(); Base64.Encoder base64Encoder = Base64.getEncoder(); Map<Serde, String> serdeUUIDs = new HashMap<>(); serdes.forEach(serde -> { String serdeName = serdeUUIDs.computeIfAbsent(serde, s -> serde.getClass().getSimpleName() + "-" + UUID.randomUUID().toString()); serdeConfigs.putIfAbsent(String.format(SerializerConfig.SERDE_SERIALIZED_INSTANCE(), serdeName), base64Encoder.encodeToString(serializableSerde.toBytes(serde))); }); tableKeySerdes.forEach((tableId, serde) -> { String keySerdeConfigKey = String.format(JavaTableConfig.STORE_KEY_SERDE, tableId); serdeConfigs.put(keySerdeConfigKey, serdeUUIDs.get(serde)); }); tableValueSerdes.forEach((tableId, serde) -> { String valueSerdeConfigKey = String.format(JavaTableConfig.STORE_MSG_SERDE, tableId); serdeConfigs.put(valueSerdeConfigKey, serdeUUIDs.get(serde)); }); return serdeConfigs; }
Source:
public void run() { try { Thread.sleep(McUtils.SECOND * 10); } catch (InterruptedException ex) { _logger.error("Exception, ", ex); } while (!isTerminate()) { try { _logger.debug("Getting hue lights...on user request : ", onRequestUpdate); final ClientResponse<Map<String, LightState>> listAll = philipsHueClient.lights().listAll(); if (listAll.isSuccess()) { Map<String, LightState> clientResponse = listAll.getEntity(); _logger.debug("Client response: ", clientResponse, onRequestUpdate); if (clientResponse != null && !clientResponse.isEmpty()) { updateRecords(clientResponse); } else { _logger.warn("Error no light found ", philipsHueClient); } } else { _logger.debug("Error while getting hue lights: - ", listAll.getStatusCode(), listAll.getErrorMsg()); waitOnError(); } long pollFrequency = gateway.getPollFrequency() * McUtils.MINUTE; while (pollFrequency > 0 && !isTerminate() && !onRequestUpdate) { Thread.sleep(100); pollFrequency -= 100; } onRequestUpdate = false; } catch (Exception ex) { _logger.error("Exception, ", ex); waitOnError(); } } _logger.debug("PhilipsHueGatewayPoller Terminated..."); this.terminated = true; }

Target:
public void run() { waitFor(McUtils.SECOND * 10); while (!isTerminate()) { try { _logger.debug("Getting hue lights...on user request : ", onRequestUpdate); final ClientResponse<Map<String, LightState>> clientResponse = philipsHueClient.lights().listAll(); if (clientResponse.isSuccess()) { Map<String, LightState> lights = clientResponse.getEntity(); _logger.debug("Client response: ", clientResponse, onRequestUpdate); if (clientResponse != null && !lights.isEmpty()) { updateRecords(lights); } else { _logger.warn("Error no light found ", philipsHueClient); } } else { _logger.debug("Error while getting hue lights: {}", clientResponse); _logger.debug("On error retrying..."); waitFor(2000); } long pollFrequency = gateway.getPollFrequency() * McUtils.MINUTE; while (pollFrequency > 0 && !isTerminate() && !onRequestUpdate) { Thread.sleep(100); pollFrequency -= 100; } onRequestUpdate = false; } catch (Exception ex) { _logger.error("Exception, ", ex); _logger.debug("On error retrying..."); waitFor(2000); } } _logger.debug("PhilipsHueGatewayPoller Terminated..."); this.terminated = true; }
Source:
public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } widStr = widStr.replace("\r\n", "\n"); List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }

Target:
public static List<WorkItemDefinition> parse(String widStr) { if (empty(widStr)) { return Collections.emptyList(); } List<WorkItemDefinition> widList = new ArrayList<>(); String[] lines = widStr.split("\r\n|\r|\n"); Queue<String> linesQueue = new LinkedList<>(Arrays.asList(lines)); while (!linesQueue.isEmpty()) { String line = linesQueue.peek().trim(); if (!(empty(line) || isStartingObject(line) || isEndingObject(line))) { WorkItemDefinition wid = parseWorkItemDefinitionObject(linesQueue); widList.add(wid); } linesQueue.poll(); } return widList; }
Source:
private void testEditResponse() throws Exception { ______TS("edit responses"); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("Student 1 self feedback.", fr.getResponseDetails().getAnswerString()); submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse"); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html"); submitPage.fillResponseRichTextEditor(1, 0, "Good design"); submitPage.clickSubmitButton(); submitPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString()); submitPage.waitForAndDismissAlertModal(); }

Target:
private void testEditResponse() throws Exception { ______TS("edit responses"); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("Student 1 self feedback.", fr.getResponseDetails().getAnswerString()); submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse"); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html"); submitPage.fillResponseRichTextEditor(1, 0, "Good design"); submitPage.clickSubmitButton(); submitPage.verifyStatus(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED); submitPage.verifyAndCloseSuccessfulSubmissionModal(); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString()); }
Source:
public static String m(String key, Object... args) { String result = messages.getProperty(key); if (result == null) { Gdx.app.log("I18N", "No message for key " + key + ", lang " + lang); result = key; } int end = result.indexOf(argMarker); if (end == -1) { if (args.length != 0) { Gdx.app.log("I18N", "Extra args passed to " + key + ": " + Arrays.toString(args) + " but none expected in '" + result + "'"); } return result; } else if (args.length == 0) { Gdx.app.log("I18N", "No args passed to " + key + ": but expected at least 1 in '" + result + "'"); return result; } StringBuilder replaced = new StringBuilder(result.length()); int currentArg = 0; int start = 0; int substitutions = 0; do { if (currentArg == args.length) { Gdx.app.log("I18N", "Substitution requested in key " + key + " " + " but not enough args " + Arrays.toString(args) + " provided for message '" + result + "'; recycling args"); if (args.length == 0) { return result; } else { currentArg %= args.length; } } replaced.append(result.substring(start, end)).append( args[currentArg]); currentArg++; substitutions++; start = end + "{}".length(); end = result.indexOf("{}", start); } while (end != -1); if (currentArg != args.length) { Gdx.app.log("I18N", "Bad number of args (" + args.length + ") passed to " + key + ": expected " + substitutions + " args for '" + result + "'"); } replaced.append(result.substring(start)); return replaced.toString(); }

Target:
public static String m(String key, Object... args) { String result = messages.getProperty(key); if (result == null) { Gdx.app.log("I18N", "No message for key " + key + ", lang " + lang); result = key; } int end = result.indexOf(argMarker); if (end == -1) { if (args.length != 0) { Gdx.app.log("I18N", "Extra args passed to " + key + ": " + Arrays.toString(args) + " but none expected in '" + result + "'"); } return result; } else if (args.length == 0) { Gdx.app.log("I18N", "No args passed to " + key + ": but expected at least 1 in '" + result + "'"); return result; } StringBuilder replaced = new StringBuilder(result.length()); int currentArg = 0; int start = 0; int substitutions = 0; do { if (currentArg == args.length) { Gdx.app.log("I18N", "Substitution requested in key " + key + " " + " but not enough args " + Arrays.toString(args) + " provided for message '" + result + "'; recycling args"); currentArg = 0; } replaced.append(result.substring(start, end)).append( args[currentArg]); currentArg++; substitutions++; start = end + "{}".length(); end = result.indexOf("{}", start); } while (end != -1); if (currentArg != args.length) { Gdx.app.log("I18N", "Bad number of args (" + args.length + ") passed to " + key + ": expected " + substitutions + " args for '" + result + "'"); } replaced.append(result.substring(start)); return replaced.toString(); }
Source:
private List<DeepLinkAnnotatedElement> getElements() { TypeElement element1 = mock(TypeElement.class); Name name1 = mock(Name.class); when(elements.getDocComment(element1)).thenReturn("Sample doc \n @param empty \n @return nothing"); when(element1.getSimpleName()).thenReturn(name1); when(name1.toString()).thenReturn("DocClass"); TypeElement element2 = mock(TypeElement.class); TypeElement element2Enclosed = mock(TypeElement.class); Name name2 = mock(Name.class); Name name2Enclosed = mock(Name.class); when(element2.getSimpleName()).thenReturn(name2); when(name2.toString()).thenReturn("DocMethod"); when(element2.getEnclosingElement()).thenReturn(element2Enclosed); when(element2Enclosed.getSimpleName()).thenReturn(name2Enclosed); when(name2Enclosed.toString()).thenReturn("DocClass"); try { DeepLinkAnnotatedElement deepLinkElement1 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element1, DeepLinkEntry.Type.CLASS); DeepLinkAnnotatedElement deepLinkElement2 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element2, DeepLinkEntry.Type.METHOD); return ImmutableList.of(deepLinkElement1, deepLinkElement2); } catch (MalformedURLException e) { } return null; }

Target:
private List<DeepLinkAnnotatedElement> getElements() throws MalformedURLException { TypeElement element1 = mock(TypeElement.class); Name name1 = mock(Name.class); when(elements.getDocComment(element1)) .thenReturn("Sample doc \n @param empty \n @return nothing"); when(element1.getSimpleName()).thenReturn(name1); when(name1.toString()).thenReturn("DocClass"); TypeElement element2 = mock(TypeElement.class); TypeElement element2Enclosed = mock(TypeElement.class); Name name2 = mock(Name.class); Name name2Enclosed = mock(Name.class); when(element2.getSimpleName()).thenReturn(name2); when(name2.toString()).thenReturn("DocMethod"); when(element2.getEnclosingElement()).thenReturn(element2Enclosed); when(element2Enclosed.getSimpleName()).thenReturn(name2Enclosed); when(name2Enclosed.toString()).thenReturn("DocClass"); DeepLinkAnnotatedElement deepLinkElement1 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element1, DeepLinkEntry.Type.CLASS); DeepLinkAnnotatedElement deepLinkElement2 = new DeepLinkAnnotatedElement("airbnb://example.com/{foo}/bar", element2, DeepLinkEntry.Type.METHOD); return ImmutableList.of(deepLinkElement1, deepLinkElement2); }
Source:
protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int timeout = resolvedValue.asInt(); TxControl.setDefaultTimeout(timeout); if (timeout == 0) { timeout = TransactionSubsystemRootResourceDefinition.maximum_timeout; TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(timeout); } ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeout); return false; }

Target:
protected boolean applyUpdateToRuntime(final OperationContext context, final ModelNode operation, final String attributeName, final ModelNode resolvedValue, final ModelNode currentValue, final HandbackHolder<Void> handbackHolder) throws OperationFailedException { int timeout = resolvedValue.asInt(); TxControl.setDefaultTimeout(timeout); if (timeout == 0) { ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); timeout = MAXIMUM_TIMEOUT.resolveModelAttribute(context, model).asInt(); TransactionLogger.ROOT_LOGGER.timeoutValueIsSetToMaximum(timeout); } ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeout); return false; }
Source:
private void refactorAttribute(TaskData taskData, TaskAttribute attribute) { if (taskData != null) { TaskAttribute original = taskData.getRoot().getMappedAttribute(attribute.getPath()); if (original != null) { TaskAttribute parent = original.getParentAttribute(); parent.removeAttribute(original.getId()); parent.deepAddCopy(attribute); } } }

Target:
private void refactorAttribute(TaskData taskData, TaskAttribute attribute) throws CoreException { if (taskData != null) { String[] path = attribute.getPath(); if (path.length == 0) { throw new CoreException( new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, Messages.TaskDataState_RefactorRoot)); } String[] shortenedPath = Arrays.copyOfRange(path, 0, path.length - 1); TaskAttribute parent = taskData.getRoot().getMappedAttribute(shortenedPath); if (parent != null) { parent.removeAttribute(attribute.getId()); parent.deepAddCopy(attribute); } } }
Source:
public String getAdvertisedHost() { if(CLI_HOST_NAME != null) return CLI_HOST_NAME; try { return new URL(Jenkins.getInstanceOrNull().getRootUrl()).getHost(); } catch (MalformedURLException | NullPointerException e) { throw new IllegalStateException("Could not get Jenkins host name", e); } }

Target:
public String getAdvertisedHost() { if (CLI_HOST_NAME != null) { return CLI_HOST_NAME; } try { return new URL(Jenkins.get().getRootUrl()).getHost(); } catch (MalformedURLException | NullPointerException e) { throw new IllegalStateException("Could not get TcpSlaveAgentListener host name", e); } }
Source:
public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { if (parser.getCurrentToken() == JsonToken.VALUE_NULL) { blockBuilder.appendNull(); return; } checkState(parser.currentToken() == START_OBJECT, "Expected a json object"); BlockBuilder entryBuilder = blockBuilder.beginBlockEntry(); HashTable entryBuilderHashTable = new HashTable(keyType, entryBuilder); int position = 0; while (parser.nextToken() != END_OBJECT) { keyAppender.append(parser, entryBuilder); parser.nextToken(); valueAppender.append(parser, entryBuilder); if (!entryBuilderHashTable.addIfAbsent(position)) { throw new JsonCastException("Duplicate keys are not allowed"); } position += 2; } blockBuilder.closeEntry(); }

Target:
public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { if (parser.getCurrentToken() == JsonToken.VALUE_NULL) { blockBuilder.appendNull(); return; } if (parser.getCurrentToken() != START_OBJECT) { throw new JsonCastException(format("Expected a json object, but got %s", parser.getText())); } BlockBuilder entryBuilder = blockBuilder.beginBlockEntry(); HashTable entryBuilderHashTable = new HashTable(keyType, entryBuilder); int position = 0; while (parser.nextToken() != END_OBJECT) { keyAppender.append(parser, entryBuilder); parser.nextToken(); valueAppender.append(parser, entryBuilder); if (!entryBuilderHashTable.addIfAbsent(position)) { throw new JsonCastException("Duplicate keys are not allowed"); } position += 2; } blockBuilder.closeEntry(); }
Source:
Consumer<Frame> grantedLeasesReceiver() { return f -> { synchronized (lock) { leaseReceived = true; if (pendingSentLease != null) { Lease lease = pendingSentLease; pendingSentLease = null; long now = System.currentTimeMillis(); int newTTl = (int) Math.max(lease.expiry() - now, 0); sendLease(new LeaseImpl(lease.getAllowedRequests(), newTTl, lease.getMetadata())); } leaseReceived(f); } }; }

Target:
Consumer<Lease> grantedLeasesReceiver() { return f -> { synchronized (this) { leaseReceived = true; if (pendingSentLease != null) { Lease lease = pendingSentLease; pendingSentLease = null; long now = System.currentTimeMillis(); int newTTl = (int) Math.max(lease.expiry() - now, 0); sendLease(new LeaseImpl(lease.getAllowedRequests(), newTTl, lease.getMetadata())); } leaseReceived(f); } }; }
Source:
public void setUp() throws Exception { BeanUtils.assertAutowiring(this); m_bsmd = new Bsmd(); m_bsmd.setBusinessServiceDao(m_businessServiceDao); m_bsmd.setAlarmDao(m_alarmDao); m_bsmd.setEventIpcManager(m_eventMgr); m_bsmd.setEventConfDao(m_eventConfDao); m_bsmd.setTransactionTemplate(m_template); m_bsmd.setVerifyReductionKeys(false); m_bsmd.setBusinessServiceStateMachine(new DefaultBusinessServiceStateMachine()); m_bsmd.afterPropertiesSet(); m_databasePopulator.populateDatabase(); m_anticipator = new EventAnticipator(); m_eventMgr.setEventAnticipator(m_anticipator); }

Target:
public void setUp() throws Exception { BeanUtils.assertAutowiring(this); m_bsmd.setVerifyReductionKeys(false); m_bsmd.setEventIpcManager(m_eventMgr); m_databasePopulator.populateDatabase(); m_anticipator = new EventAnticipator(); m_eventMgr.setEventAnticipator(m_anticipator); }
Source:
public static void main(String[] args) throws Exception { String dataLocation = "data/1K-pages.txt"; String templateLocation = "modules/ui/src/main/resources/spark/template/freemarker"; if (args.length == 2) { dataLocation = args[0]; templateLocation = args[1]; } log.info("Looking for data at {}", dataLocation); Path dataPath = Paths.get(dataLocation); if (Files.notExists(dataPath)) { log.info("Generating sample data at for dev server", dataPath); SampleData.generate(dataPath, 1000); } Path templatePath = Paths.get(templateLocation); if (Files.notExists(templatePath)) { log.info("Template location does not exits", templateLocation); throw new IllegalArgumentException("Template location does not exist"); } DevServer devServer = new DevServer(dataPath, Paths.get("/tmp/"), 4567, templatePath); devServer.start(); }

Target:
public static void main(String[] args) throws Exception { String dataLocation = "data/1K-pages.txt"; String templateLocation = "modules/ui/src/main/resources/spark/template/freemarker"; if (args.length == 2) { dataLocation = args[0]; templateLocation = args[1]; } log.info("Looking for data at {}", dataLocation); Path dataPath = Paths.get(dataLocation); if (Files.notExists(dataPath)) { log.info("Generating sample data at for dev server", dataPath); SampleData.generate(dataPath, 1000); } Path templatePath = Paths.get(templateLocation); if (Files.notExists(templatePath)) { log.info("Template location does not exits", templateLocation); throw new IllegalArgumentException("Template location does not exist"); } DevServer devServer = new DevServer(dataPath, 4567, templatePath, Files.createTempDirectory("webindex-dev-")); devServer.start(); }
Source:
private List<Chunk> getBinChunks(Bin bin) { if (bin.containsChunks()) { return bin.getChunkList(); } if (bin.getBinNumber() < SRA_BIN_INDEX_OFFSET) { throw new RuntimeException("SRA only supports bins from the last level"); } int binNumber = bin.getBinNumber() - SRA_BIN_INDEX_OFFSET; long refOffset = recordRangleInfo.getReferenceOffsets().get(bin.getReferenceSequence()); int firstChunkCorrection = binNumber == 0 ? 0 : -5000; long binGlobalOffset = binNumber * SRA_BIN_SIZE + refOffset; long firstChunkNumber = (binGlobalOffset + firstChunkCorrection) / SRA_CHUNK_SIZE; long lastChunkNumber = (binGlobalOffset + SRA_BIN_SIZE - 1) / SRA_CHUNK_SIZE; List<Chunk> chunks = new ArrayList<Chunk>(); for (long chunkNumber = firstChunkNumber; chunkNumber <= lastChunkNumber; chunkNumber++) { chunks.add(new Chunk(chunkNumber * SRA_CHUNK_SIZE, (chunkNumber + 1) * SRA_CHUNK_SIZE)); } return chunks; }

Target:
private List<Chunk> getBinChunks(Bin bin) { if (bin.containsChunks()) { return bin.getChunkList(); } if (bin.getBinNumber() < SRA_BIN_INDEX_OFFSET) { throw new RuntimeException("SRA only supports bins from the last level"); } int binNumber = bin.getBinNumber() - SRA_BIN_INDEX_OFFSET; long refOffset = recordRangeInfo.getReferenceOffsets().get(bin.getReferenceSequence()); int firstChunkCorrection = binNumber == 0 ? 0 : -MAX_FRAGMENT_OVERLAP; long binGlobalOffset = binNumber * SRA_BIN_SIZE + refOffset; long firstChunkNumber = (binGlobalOffset + firstChunkCorrection) / SRA_CHUNK_SIZE; long lastChunkNumber = (binGlobalOffset + SRA_BIN_SIZE - 1) / SRA_CHUNK_SIZE; List<Chunk> chunks = new ArrayList<Chunk>(); for (long chunkNumber = firstChunkNumber; chunkNumber <= lastChunkNumber; chunkNumber++) { chunks.add(new Chunk(chunkNumber * SRA_CHUNK_SIZE, (chunkNumber + 1) * SRA_CHUNK_SIZE)); } return chunks; }
Source:
private void syncGroupOffset() throws InterruptedException { for (String group : consumerGroups) { try { List<Checkpoint> checkpoints = listConsumerGroupOffsets(group).entrySet().stream() .filter(x -> shouldCheckpointTopic(x.getKey().topic())) .map(x -> checkpoint(group, x.getKey(), x.getValue())) .filter(x -> x.downstreamOffset() > 0) .collect(Collectors.toList()); DescribeConsumerGroupsResult describedGroups = targetAdminClient.describeConsumerGroups( Lists.newArrayList(group)); for (Map.Entry<String, KafkaFuture<ConsumerGroupDescription>> entry : describedGroups.describedGroups().entrySet()) { ConsumerGroupDescription consumerGroupDescription = entry.getValue().get(); if (consumerGroupDescription.state().equals(ConsumerGroupState.EMPTY)) { alterGroupOffset(group, checkpoints); } } } catch (ExecutionException e) { log.error("Error querying offsets for consumer group on cluster {}.", group, sourceClusterAlias, e); } } }

Target:
Map<String, Map<TopicPartition, OffsetAndMetadata>> syncGroupOffset() { Map<String, Map<TopicPartition, OffsetAndMetadata>> offsetToSyncAll = new HashMap<>(); for (Entry<String, Map<TopicPartition, OffsetAndMetadata>> group : getConvertedUpstreamOffset().entrySet()) { String consumerGroupId = group.getKey(); Map<TopicPartition, OffsetAndMetadata> convertedUpstreamOffset = group.getValue(); Map<TopicPartition, OffsetAndMetadata> offsetToSync = new HashMap<>(); Map<TopicPartition, OffsetAndMetadata> targetConsumerOffset = idleConsumerGroupsOffset.get(consumerGroupId); if (targetConsumerOffset == null) { syncGroupOffset(consumerGroupId, convertedUpstreamOffset); offsetToSyncAll.put(consumerGroupId, convertedUpstreamOffset); continue; } for (Entry<TopicPartition, OffsetAndMetadata> convertedEntry : convertedUpstreamOffset.entrySet()) { TopicPartition topicPartition = convertedEntry.getKey(); OffsetAndMetadata convertedOffset = convertedUpstreamOffset.get(topicPartition); if (!targetConsumerOffset.containsKey(topicPartition)) { offsetToSync.put(topicPartition, convertedOffset); continue; } long latestDownstreamOffset = targetConsumerOffset.get(topicPartition).offset(); if (latestDownstreamOffset >= convertedOffset.offset()) { log.trace("latestDownstreamOffset is larger than or equal to convertedUpstreamOffset for " + "TopicPartition {}", latestDownstreamOffset, convertedOffset.offset(), topicPartition); continue; } offsetToSync.put(topicPartition, convertedOffset); } if (offsetToSync.size() == 0) { log.trace("skip syncing the offset for consumer group: {}", consumerGroupId); continue; } syncGroupOffset(consumerGroupId, offsetToSync); offsetToSyncAll.put(consumerGroupId, offsetToSync); } idleConsumerGroupsOffset.clear(); return offsetToSyncAll; }
Source:
public static InfluxDBException buildExceptionFromErrorMessage(final String errorMessage) { if (errorMessage.contains(DATABASE_NOT_FOUND_ERROR)) { return new DatabaseNotFoundException(errorMessage); } if (errorMessage.contains(POINTS_BEYOND_RETENTION_POLICY_ERROR)) { return new PointsBeyondRetentionPolicyException(errorMessage); } if (errorMessage.contains(FIELD_TYPE_CONFLICT_ERROR)) { return new FieldTypeConflictException(errorMessage); } if (errorMessage.contains(UNABLE_TO_PARSE_ERROR)) { return new UnableToParseException(errorMessage); } if (errorMessage.contains(HINTED_HAND_OFF_QUEUE_NOT_EMPTY_ERROR)) { return new HintedHandOffQueueNotEmptyException(errorMessage); } if (errorMessage.contains(CACHE_MAX_MEMORY_SIZE_EXCEEDED_ERROR)) { return new CacheMaxMemorySizeExceededException(errorMessage); } if (errorMessage.contains(USER_REQUIRED_ERROR) || errorMessage.contains(USER_NOT_AUTHORIZED_ERROR) || errorMessage.contains(AUTHORIZATION_FAILED_ERROR) || errorMessage.contains(USERNAME_REQUIRED_ERROR)) { return new AuthorizationFailedException(errorMessage); } return new InfluxDBException(errorMessage); }

Target:
private static InfluxDBException buildExceptionFromErrorMessage(final String errorMessage) { if (errorMessage.contains(DATABASE_NOT_FOUND_ERROR)) { return new DatabaseNotFoundException(errorMessage); } if (errorMessage.contains(POINTS_BEYOND_RETENTION_POLICY_ERROR)) { return new PointsBeyondRetentionPolicyException(errorMessage); } if (errorMessage.contains(FIELD_TYPE_CONFLICT_ERROR)) { return new FieldTypeConflictException(errorMessage); } if (errorMessage.contains(UNABLE_TO_PARSE_ERROR)) { return new UnableToParseException(errorMessage); } if (errorMessage.contains(HINTED_HAND_OFF_QUEUE_NOT_EMPTY_ERROR)) { return new HintedHandOffQueueNotEmptyException(errorMessage); } if (errorMessage.contains(CACHE_MAX_MEMORY_SIZE_EXCEEDED_ERROR)) { return new CacheMaxMemorySizeExceededException(errorMessage); } if (errorMessage.contains(USER_REQUIRED_ERROR) || errorMessage.contains(USER_NOT_AUTHORIZED_ERROR) || errorMessage.contains(AUTHORIZATION_FAILED_ERROR) || errorMessage.contains(USERNAME_REQUIRED_ERROR)) { return new AuthorizationFailedException(errorMessage); } return new InfluxDBException(errorMessage); }
Source:
public void sampleBoardAutoCreationTest() { assertEquals(panelControl.getNumberOfSavedBoards(), 0); clickMenu("Boards", "Auto-create", SAMPLE_BOARD); PlatformEx.waitOnFxThread(); assertNodeExists(hasText(SAMPLE_BOARD + " has been created and loaded.\n\n" + "It is saved under the name \"" + SAMPLE_BOARD + "\".")); click("OK"); assertEquals(panelControl.getPanelCount(), 3); assertEquals(panelControl.getCurrentlySelectedPanel(), Optional.of(0)); assertEquals(panelControl.getNumberOfSavedBoards(), 1); List<PanelInfo> panelInfos = panelControl.getCurrentPanelInfos(); assertEquals(panelInfos.get(0).getPanelFilter(), FIRST_SAMPLE_FILTER); assertEquals(panelInfos.get(1).getPanelFilter(), SECOND_SAMPLE_FILTER); assertEquals(panelInfos.get(2).getPanelFilter(), THIRD_SAMPLE_FILTER); assertEquals(panelInfos.get(0).getPanelName(), FIRST_SAMPLE_PANEL_NAME); assertEquals(panelInfos.get(1).getPanelName(), SECOND_SAMPLE_PANEL_NAME); assertEquals(panelInfos.get(2).getPanelName(), THIRD_SAMPLE_PANEL_NAME); }

Target:
public void sampleBoardAutoCreationTest() { assertEquals(panelControl.getNumberOfSavedBoards(), 0); clickMenu("Boards", "Auto-create", SAMPLE_BOARD); waitUntilNodeAppears(SAMPLE_BOARD_DIALOG); click("OK"); assertEquals(panelControl.getPanelCount(), SAMPLE_PANEL_NAMES.size()); assertEquals(panelControl.getCurrentlySelectedPanel(), Optional.of(0)); assertEquals(panelControl.getNumberOfSavedBoards(), 1); List<PanelInfo> panelInfos = panelControl.getCurrentPanelInfos(); for (int i = 0; i < SAMPLE_PANEL_NAMES.size(); i++){ assertEquals(panelInfos.get(i).getPanelFilter(), SAMPLE_PANEL_FILTERS.get(i)); assertEquals(panelInfos.get(i).getPanelName(), SAMPLE_PANEL_NAMES.get(i)); } }
Source:
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("custom", "password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(600) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() .withClient("my-client-with-unlimited-scopes") .authorizedGrantTypes("password", "refresh_token"); }

Target:
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("my-trusted-client") .authorizedGrantTypes("custom", "password", "authorization_code", "refresh_token", "implicit") .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") .scopes("read", "write", "trust") .resourceIds("oauth2-resource") .accessTokenValiditySeconds(600) .redirectUris("https://anywhere") .and() .withClient("my-client-with-registered-redirect") .authorizedGrantTypes("authorization_code") .authorities("ROLE_CLIENT") .scopes("read", "trust") .resourceIds("oauth2-resource") .redirectUris("https://anywhere?key=value") .and() .withClient("my-client-with-secret") .authorizedGrantTypes("client_credentials", "password") .authorities("ROLE_CLIENT") .scopes("read") .resourceIds("oauth2-resource") .secret("secret") .and() .withClient("my-client-with-empty-scopes") .authorizedGrantTypes("password", "refresh_token"); }
Source:
private ServiceInfo parseServiceInfo(Map<String, Object> volumeServiceInfo) { ServiceInfo serviceInfo = new ServiceInfo(); if (volumeServiceInfo.containsKey(HOSTNAME)) { serviceInfo.setHostName((String) volumeServiceInfo.get(HOSTNAME)); } if (volumeServiceInfo.containsKey(STATUS)) { String brickStatus = (String) volumeServiceInfo.get(STATUS); if (brickStatus.toUpperCase().equals(ONLINE)) { serviceInfo.setStatus(GlusterStatus.UP); if (volumeServiceInfo.containsKey(PORT)) { serviceInfo.setPort(Integer.valueOf((String) volumeServiceInfo.get(PORT))); } if (volumeServiceInfo.containsKey(PID)) { serviceInfo.setPid(Integer.valueOf((String) volumeServiceInfo.get(PID))); } } else { serviceInfo.setStatus(GlusterStatus.DOWN); } } return serviceInfo; }

Target:
private ServiceInfo parseServiceInfo(Map<String, Object> volumeServiceInfo) { ServiceInfo serviceInfo = new ServiceInfo(); if (volumeServiceInfo.containsKey(HOSTNAME)) { serviceInfo.setHostName((String) volumeServiceInfo.get(HOSTNAME)); } if (volumeServiceInfo.containsKey(STATUS)) { String brickStatus = (String) volumeServiceInfo.get(STATUS); if (brickStatus.toUpperCase().equals(ONLINE)) { serviceInfo.setStatus(GlusterStatus.UP); if (volumeServiceInfo.containsKey(PORT)) { serviceInfo.setPort(Integer.parseInt((String) volumeServiceInfo.get(PORT))); } if (volumeServiceInfo.containsKey(PID)) { serviceInfo.setPid(Integer.parseInt((String) volumeServiceInfo.get(PID))); } } else { serviceInfo.setStatus(GlusterStatus.DOWN); } } return serviceInfo; }
Source:
public void testGitHubBug208ParseError() throws Exception { String c = IOUtils.toString(this.getClass().getResourceAsStream("GitHubBug208.java"), StandardCharsets.UTF_8); parseJava15(c); }

Target:
public void testGitHubBug208ParseError() { String c = readAsString("GitHubBug208.java"); parseJava15(c); }
Source:
public static String getToken(final HttpServletRequest req){ String token; String encodedToken = req.getPathInfo(); if (Strings.isNullOrEmpty(encodedToken)) { token = DEFAULT_TOKEN; } else { token = CharMatcher.is('/').trimLeadingFrom(Url.decode(encodedToken)); } return token; }

Target:
public static String getToken(final HttpServletRequest req){ String encodedToken = req.getPathInfo(); if (Strings.isNullOrEmpty(encodedToken)) { return DEFAULT_TOKEN; } else { return CharMatcher.is('/').trimLeadingFrom(Url.decode(encodedToken)); } }
Source:
protected synchronized void handleEvent(CoordinatorEvent event) { _log.info("START: Handle event " + event.getType() + ", Instance: " + _adapter.getInstanceName()); try { switch (event.getType()) { case LEADER_DO_ASSIGNMENT: handleLeaderDoAssignment(); break; case HANDLE_ASSIGNMENT_CHANGE: handleAssignmentChange(); break; case HANDLE_ADD_OR_DELETE_DATASTREAM: handleDatastreamAddOrDelete(); break; case HANDLE_INSTANCE_ERROR: handleInstanceError((CoordinatorEvent.HandleInstanceError) event); break; default: String errorMessage = String.format("Unknown event type %s.", event.getType()); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, errorMessage, null); break; } } catch (Exception e) { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleEvent", NUM_ERRORS, 1); _log.error("ERROR: event + " + event + " failed.", e); } _log.info("END: Handle event " + event); }

Target:
protected synchronized void handleEvent(CoordinatorEvent event) { _log.info("START: Handle event " + event.getType() + ", Instance: " + _adapter.getInstanceName()); try { switch (event.getType()) { case LEADER_DO_ASSIGNMENT: handleLeaderDoAssignment(); break; case HANDLE_ASSIGNMENT_CHANGE: handleAssignmentChange(); break; case HANDLE_ADD_OR_DELETE_DATASTREAM: handleDatastreamAddOrDelete(); break; case HANDLE_INSTANCE_ERROR: handleInstanceError((CoordinatorEvent.HandleInstanceError) event); break; default: String errorMessage = String.format("Unknown event type %s.", event.getType()); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, errorMessage, null); break; } } catch (Exception e) { _dynamicMetricsManager.createOrUpdateCounter(this.getClass(), "handleEvent-" + event.getType(), NUM_ERRORS, 1); _log.error("ERROR: event + " + event + " failed.", e); } _log.info("END: Handle event " + event); }
Source:
private void resetAndStartScheduler() throws Exception { validateRunsInMainThread(); final CompletableFuture<Void> schedulerAssignedFuture; if (schedulerNG.requestJobStatus() == JobStatus.CREATED) { schedulerAssignedFuture = CompletableFuture.completedFuture(null); schedulerNG.start(getMainThreadExecutor()); } else { suspendAndClearSchedulerFields(new FlinkException("ExecutionGraph is being reset in order to be rescheduled.")); final JobManagerJobMetricGroup newJobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph); final SchedulerNG newScheduler = createScheduler(executionDeploymentTracker, newJobManagerJobMetricGroup); schedulerAssignedFuture = schedulerNG.getTerminationFuture().handle( (ignored, throwable) -> { newScheduler.start(getMainThreadExecutor()); assignScheduler(newScheduler, newJobManagerJobMetricGroup); return null; } ); } schedulerAssignedFuture.thenRun(this::startScheduling); }

Target:
private void resetAndStartScheduler() throws Exception { validateRunsInMainThread(); final CompletableFuture<Void> schedulerAssignedFuture; if (schedulerNG.requestJobStatus() == JobStatus.CREATED) { schedulerAssignedFuture = CompletableFuture.completedFuture(null); schedulerNG.initialize(getMainThreadExecutor()); } else { suspendAndClearSchedulerFields(new FlinkException("ExecutionGraph is being reset in order to be rescheduled.")); final JobManagerJobMetricGroup newJobManagerJobMetricGroup = jobMetricGroupFactory.create(jobGraph); final SchedulerNG newScheduler = createScheduler(executionDeploymentTracker, newJobManagerJobMetricGroup); schedulerAssignedFuture = schedulerNG.getTerminationFuture().handle( (ignored, throwable) -> { newScheduler.initialize(getMainThreadExecutor()); assignScheduler(newScheduler, newJobManagerJobMetricGroup); return null; } ); } FutureUtils.assertNoException(schedulerAssignedFuture.thenRun(this::startScheduling)); }
Source:
static boolean mustEncode(char ch) { return (ch & 0xff) >= 128 || ch >= 0 && ch < 10 || ch >= 11 && ch < 32 || ch == '='; }

Target:
static boolean mustEncode(char ch) { return ch >= 128 || ch < 10 || ch >= 11 && ch < 32 || ch == '='; }