auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response signup(@FormParam("courseId") String courseId, @FormParam("components")Set<String> components, @FormParam("email")String email, @FormParam("message")String message) { if (UserDirectoryService.getAnonymousUser().equals(UserDirectoryService.getCurrentUser())) { throw new WebAppForbiddenException(); } try { CourseSignup entity = courseService.signup(courseId, components, email, message); ResponseBuilder builder = Response.status(Response.Status.CREATED); builder.status(201); builder.entity(entity); return builder.build(); } catch (IllegalStateException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } catch (IllegalArgumentException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } }

Target:
public Response signup(@FormParam("courseId") String courseId, @FormParam("components")Set<String> components, @FormParam("email")String email, @FormParam("message")String message) { if (UserDirectoryService.getAnonymousUser().equals(UserDirectoryService.getCurrentUser())) { throw new WebAppForbiddenException(); } try { CourseSignup entity = courseService.signup(courseId, components, email, message); ResponseBuilder builder = Response.status(Response.Status.CREATED); builder.status(201); builder.entity(entity); return builder.build(); } catch (NotFoundException e) { throw new WebAppNotFoundException(); } catch (IllegalStateException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } catch (IllegalArgumentException e) { Map<String, String> myMap = new HashMap<String, String>(); myMap.put("status", "failed"); myMap.put("message", e.getMessage()); throw new WebAppBadRequestException(myMap); } }
Source:
public void updateIndexSettings(String indexPattern, Map<String, ?> settings) { if (!isElasticsearchAvailable()) { return; } final String url = corePlugin.getElasticsearchUrl() + "/" + indexPattern + "/_settings?ignore_unavailable=true"; logger.info("Updating index settings {}\n{}", corePlugin.removeUserInfo(url), settings); httpClient.sendAsJson("PUT", url, settings, CONTENT_TYPE_JSON); }

Target:
public void updateIndexSettings(String indexPattern, Map<String, ?> settings) { if (!isElasticsearchAvailable()) { return; } final String url = corePlugin.getElasticsearchUrl() + "/" + indexPattern + "/_settings?ignore_unavailable=true"; logger.info("Updating index settings {}\n{}", HttpClient.removeUserInfo(url), settings); httpClient.sendAsJson("PUT", url, settings, CONTENT_TYPE_JSON); }
Source:
public AsyncJobStatusDTO hypervisorUpdateAsync( @Verify(value = Owner.class, require = Access.READ_ONLY, subResource = SubResource.HYPERVISOR) String ownerKey, Boolean createMissing, String reporterId, String hypervisorJson) { if (hypervisorJson == null || hypervisorJson.isEmpty()) { log.debug("Host/Guest mapping provided during hypervisor update was null."); throw new BadRequestException( i18n.tr("Host to guest mapping was not provided for hypervisor update.")); } Principal principal = (this.principalProvider == null ? null : this.principalProvider.get()); log.info("Hypervisor update by principal: {}", principal); Owner owner = this.getOwner(ownerKey); JobConfig config = HypervisorUpdateJob.createJobConfig() .setOwner(owner) .setData(hypervisorJson) .setCreateMissing(createMissing.booleanValue()) .setPrincipal(principal) .setReporter(reporterId); try { AsyncJobStatus status = jobManager.queueJob(config); return translator.translate(status, AsyncJobStatusDTO.class); } catch (JobException e) { String errmsg = this.i18n.tr("An unexpected exception occurred while scheduling job \"{0}\"", config.getJobKey()); throw new IseException(errmsg, e); } }

Target:
public AsyncJobStatusDTO hypervisorUpdateAsync( @Verify(value = Owner.class, require = Access.READ_ONLY, subResource = SubResource.HYPERVISOR) String ownerKey, Boolean createMissing, String reporterId, String hypervisorJson) { if (hypervisorJson == null || hypervisorJson.isEmpty()) { log.debug("Host/Guest mapping provided during hypervisor update was null."); throw new BadRequestException( i18n.tr("Host to guest mapping was not provided for hypervisor update.")); } Principal principal = this.principalProvider.get(); log.info("Hypervisor update by principal: {}", principal); Owner owner = this.getOwner(ownerKey); JobConfig config = HypervisorUpdateJob.createJobConfig() .setOwner(owner) .setData(hypervisorJson) .setCreateMissing(createMissing.booleanValue()) .setPrincipal(principal) .setReporter(reporterId); try { AsyncJobStatus status = jobManager.queueJob(config); return translator.translate(status, AsyncJobStatusDTO.class); } catch (JobException e) { String errmsg = this.i18n.tr("An unexpected exception occurred while scheduling job \"{0}\"", config.getJobKey()); log.error(errmsg, e); throw new IseException(errmsg, e); } }
Source:
protected BigInteger calculateBalanceForAddress(Address address, boolean calculateClientSide) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getBalanceSelectSQL()); s.setString(1, address.toString()); ResultSet rs = s.executeQuery(); BigInteger balance = BigInteger.ZERO; while (rs.next()) { if(calculateClientSide) { balance = balance.add(new BigInteger(rs.getBytes(1))); } else { return BigInteger.valueOf(rs.getLong(1)); } } return balance; } catch (SQLException ex) { throw new BlockStoreException(ex); } finally { if (s != null) try { s.close(); } catch (SQLException e) { throw new BlockStoreException("Could not close statement"); } } }

Target:
protected BigInteger calculateBalanceForAddress(Address address, boolean calculateClientSide) throws BlockStoreException { maybeConnect(); PreparedStatement s = null; try { s = conn.get().prepareStatement(getBalanceSelectSQL()); s.setString(1, address.toString()); ResultSet rs = s.executeQuery(); BigInteger balance = BigInteger.ZERO; while (rs.next()) { if(calculateClientSide) { balance = balance.add(new BigInteger(rs.getBytes(1))); } else { return BigInteger.valueOf(rs.getLong(1)); } } return balance; } catch (SQLException ex) { throw new BlockStoreException(ex); } finally { if (s != null) { try { s.close(); } catch (SQLException e) { throw new BlockStoreException("Could not close statement"); } } } }
Source:
protected ConfigurableObject getInputType(Object input) { if (input instanceof EditPart) { input = ((EditPart) input).getModel(); } if (input instanceof ConfigurableObject) { return (ConfigurableObject) input; } return null; }

Target:
protected ConfigurableObject getInputType(Object input) { if (input instanceof EditPart && ((EditPart) input).getModel() instanceof ConfigurableObject) { return (ConfigurableObject) input; } return null; }
Source:
protected Control getRegisteredControl() { activate(); WidgetIsFound widgetIsFound = new WidgetIsFound(org.eclipse.swt.custom.StyledText.class, cTabItem.getControl()); new WaitUntil(widgetIsFound, TimePeriod.SHORT, false); if (widgetIsFound.getResult() == null) { return null; } return (org.eclipse.swt.custom.StyledText) widgetIsFound.getResult(); }

Target:
protected Control getRegisteredControl() { activate(); WidgetIsFound widgetIsFound = new WidgetIsFound(org.eclipse.swt.custom.StyledText.class, cTabItem.getControl()); new WaitUntil(widgetIsFound, TimePeriod.SHORT, false); if (widgetIsFound.getResult() == null) { log.debug("There is no console in console view."); return null; } return (org.eclipse.swt.custom.StyledText) widgetIsFound.getResult(); }
Source:
public String getResultsVisibleFromText(){ if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_VISIBLE)) { if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_OPENING)) { return TimeHelper.formatTime(bundle.feedbackSession.startTime); } else if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.sessionVisibleFromTime); } } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_LATER) || bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_NOW)) { return "Unspecified (to be published manually)"; } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.resultsVisibleFromTime); } }

Target:
public String getResultsVisibleFromText(){ if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_VISIBLE)) { if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_OPENING)) { return TimeHelper.formatTime(bundle.feedbackSession.startTime); } else if (bundle.feedbackSession.sessionVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.sessionVisibleFromTime); } } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_LATER)) { return "I want to manually publish the results."; } else if (bundle.feedbackSession.resultsVisibleFromTime.equals(Const.TIME_REPRESENTS_NEVER)) { return "Never"; } else { return TimeHelper.formatTime(bundle.feedbackSession.resultsVisibleFromTime); } }
Source:
public List<Player> getNonreadyPlayers() { List<Player> result = new LinkedList<>(); result.addAll(lobbyPlayers); result.removeAll(readyPlayers); result.sort(Comparator.comparing(Player:: getName)); return result; }

Target:
public List<Player> getNonreadyPlayers() { List<Player> result = new LinkedList<>(); result.addAll(lobbyPlayers); result.removeAll(readyPlayers); return result; }
Source:
public String getPostconditionAnnotation(VariableElement elt, AField f, List<String> preconds) { AnnotatedTypeMirror declaredType = fromElement(elt); if (!(declaredType.hasAnnotation(NULLABLE) || declaredType.hasAnnotation(POLYNULL) || declaredType.hasAnnotation(MONOTONIC_NONNULL))) { return null; } if (declaredType.hasAnnotation(MONOTONIC_NONNULL) && preconds.contains(requiresNonNullAnno(elt))) { return null; } for (scenelib.annotations.Annotation a : f.type.tlAnnotationsHere) { if (a.def.name.equals("org.checkerframework.checker.nullness.qual.NonNull")) { return "@org.checkerframework.checker.nullness.qual.EnsuresNonNull(\"" + elt.getSimpleName() + "\")"; } } return null; }

Target:
public String getPostconditionAnnotation(VariableElement elt, AField f, List<String> preconds) { AnnotatedTypeMirror declaredType = fromElement(elt); if (!(declaredType.hasAnnotation(NULLABLE) || declaredType.hasAnnotation(POLYNULL) || declaredType.hasAnnotation(MONOTONIC_NONNULL))) { return null; } if (declaredType.hasAnnotation(MONOTONIC_NONNULL) && preconds.contains(requiresNonNullAnno(elt))) { return null; } for (scenelib.annotations.Annotation a : f.type.tlAnnotationsHere) { if (a.def.name.equals("org.checkerframework.checker.nullness.qual.NonNull")) { return "@org.checkerframework.checker.nullness.qual.EnsuresNonNull(\"this." + elt.getSimpleName() + "\")"; } } return null; }
Source:
public AxisService findService(MessageContext mc) throws AxisFault { AxisService service = mc.getAxisService(); if (service == null) { String to = mc.getTo().getAddress(); if (to.startsWith(mc.getConfigurationContext().getServiceContextPath())) { int tenantDelimiterIndex = to.indexOf(TENANT_PATH); if (tenantDelimiterIndex != -1) { AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration(); return ac.getService(MultitenantConstants.MULTITENANT_DISPATCHER_SERVICE); } } else if (to.startsWith(TENANT_PATH)) { AxisConfiguration ac = mc.getConfigurationContext().getAxisConfiguration(); return ac.getService(MultitenantConstants.MULTITENANT_DISPATCHER_SERVICE); } } return service; }

Target:
public AxisService findService(MessageContext mc) throws AxisFault { AxisService service = mc.getAxisService(); if (service == null) { String to = mc.getTo().getAddress(); if (to.startsWith(mc.getConfigurationContext().getServiceContextPath())) { int tenantDelimiterIndex = to.indexOf(TENANT_PATH); if (tenantDelimiterIndex != -1) { return getService(mc); } } else if (to.startsWith(TENANT_PATH)) { return getService(mc); } } return service; }
Source:
private static void appendLoginModules(XmlGenerator gen, String tag, List<LoginModuleConfig> loginModuleConfigs) { gen.open(tag); for (LoginModuleConfig lm : loginModuleConfigs) { List<String> attrs = new ArrayList<String>(); attrs.add("class-name"); attrs.add(lm.getClassName()); if (lm.getUsage() != null) { attrs.add("usage"); attrs.add(lm.getUsage().name()); } gen.open("login-module", attrs.toArray()) .appendProperties(lm.getProperties()) .close(); } gen.close(); }

Target:
private static void appendLoginModules(XmlGenerator gen, String tag, List<LoginModuleConfig> loginModuleConfigs) { gen.open(tag); for (LoginModuleConfig lm : loginModuleConfigs) { List<String> attrs = new ArrayList<>(); attrs.add("class-name"); attrs.add(lm.getClassName()); if (lm.getUsage() != null) { attrs.add("usage"); attrs.add(lm.getUsage().name()); } gen.open("login-module", attrs.toArray()) .appendProperties(lm.getProperties()) .close(); } gen.close(); }
Source:
public void assertRequestWithParameters() { String cron = "0 * * * * ?"; String uri = String.format("/job/myGroup/myJob?cron=%s", URLEncoder.encode(cron, "UTF-8")); String description = "Descriptions about this job."; byte[] body = description.getBytes(StandardCharsets.UTF_8); DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri, Unpooled.wrappedBuffer(body)); request.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); HttpUtil.setContentLength(request, body.length); HttpClient.request(HOST, PORT, request, httpResponse -> { assertEquals(200, httpResponse.status().code()); byte[] bytes = ByteBufUtil.getBytes(httpResponse.content()); String json = new String(bytes, StandardCharsets.UTF_8); Gson gson = new Gson(); JobPojo jobPojo = gson.fromJson(json, JobPojo.class); assertEquals(cron, jobPojo.getCron()); assertEquals("myGroup", jobPojo.getGroup()); assertEquals("myJob", jobPojo.getName()); assertEquals(description, jobPojo.getDescription()); }, 10000L); }

Target:
public void assertRequestWithParameters() { String cron = "0 * * * * ?"; String uri = String.format("/job/myGroup/myJob?cron=%s", URLEncoder.encode(cron, "UTF-8")); String description = "Descriptions about this job."; byte[] body = description.getBytes(StandardCharsets.UTF_8); DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uri, Unpooled.wrappedBuffer(body)); request.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); HttpUtil.setContentLength(request, body.length); HttpClient.request(HOST, PORT, request, httpResponse -> { assertEquals(200, httpResponse.status().code()); byte[] bytes = ByteBufUtil.getBytes(httpResponse.content()); String json = new String(bytes, StandardCharsets.UTF_8); Gson gson = new Gson(); JobPojo jobPojo = gson.fromJson(json, JobPojo.class); assertThat(jobPojo.getCron(), is(cron)); assertThat(jobPojo.getGroup(), is("myGroup")); assertThat(jobPojo.getName(), is("myJob")); assertThat(jobPojo.getDescription(), is(description)); }, 10000L); }
Source:
private void cloneOrUpdateWithLock() throws RepositoryException { synchronized (mutex) { try { LOGGER.info("Begin fetching process of '{}' to '{}'", repositoryUri, localFolder); boolean lockFileExists = this.lockFile.exists(); if (!lockFileExists) { LOGGER.info("Creating lock file '{}' for git-repository '{}'", lockFile, repositoryUri); try { this.lockFile.getParentFile().mkdirs(); this.lockFile.createNewFile(); } catch (IOException e) { throw new RepositoryException("Couldn't create lock file " + lockFile.getAbsolutePath()); } } try (FileOutputStream lockFileStream = new FileOutputStream(lockFile, true)) { try (FileLock ignored = lockFileStream.getChannel().lock()) { cloneOrUpdate(); } } } catch (IOException e) { throw new RepositoryException("An unknown error occurred", e); } } }

Target:
private void cloneOrUpdateWithLock() throws RepositoryException { synchronized (mutex) { try { LOGGER.info("Begin fetching process of '{}' to '{}'", this.repositoryUri, this.localFolder.getAbsolutePath()); boolean lockFileExists = this.lockFile.exists(); if (!lockFileExists) { LOGGER.info("Creating lock file '{}' for git-repository '{}'", this.lockFile.getAbsolutePath(), this.repositoryUri); try { this.lockFile.getParentFile().mkdirs(); this.lockFile.createNewFile(); } catch (IOException e) { final String message = String.format("Couldn't create lock file '%s'", this.lockFile.getAbsolutePath()); throw new RepositoryException(message, e); } } try (FileOutputStream lockFileStream = new FileOutputStream(lockFile, true)) { try (FileLock ignored = lockFileStream.getChannel().lock()) { cloneOrUpdate(); } } } catch (IOException e) { throw new RepositoryException("An unknown error occurred", e); } } }
Source:
public static UseRestriction buildORRestrictionFromClasses(List<String> ontologyClasses) { List<String> validClasses = ontologyClasses.stream(). filter(s -> !s.isEmpty()). collect(Collectors.toList()); if (validClasses != null && validClasses.size() == 1) { return new Named(validClasses.get(0)); } else if (validClasses != null && validClasses.size() > 1) { Named[] named = validClasses.stream().map(Named::new). toArray(size -> new Named[validClasses.size()]); return new Or(named); } else { return null; } }

Target:
public static UseRestriction buildORRestrictionFromClasses(List<String> ontologyClasses) throws IllegalArgumentException { List<String> validClasses = ontologyClasses.stream(). filter(s -> !s.isEmpty()). collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(validClasses)) { if (validClasses.size() == 1) { return new Named(validClasses.get(0)); } else { Named[] named = validClasses.stream().map(Named::new). toArray(size -> new Named[validClasses.size()]); return new Or(named); } } throw new IllegalArgumentException("Ontology Classes cannot be empty"); }
Source:
private javax.swing.JPanel getMainPanel() { if (mainPanel == null) { mainPanel = new JPanel(new java.awt.GridBagLayout()); mainPanel.setName("CallbackPanel"); mainPanel.add(getToolBar(), newToolbarGBC()); mainPanel.add(getJScrollPane(), newScrollPaneGBC()); } return mainPanel; }

Target:
private javax.swing.JPanel getMainPanel() { if (mainPanel == null) { mainPanel = new JPanel(new BorderLayout()); mainPanel.setName("CallbackPanel"); mainPanel.add(getToolBar(), BorderLayout.PAGE_START); mainPanel.add(getJScrollPane(), BorderLayout.CENTER); } return mainPanel; }
Source:
public void fetchCartInStoreByCustomerId() { StoreFixtures.withStore(client(), store -> { CustomerFixtures.withCustomer(client(), customer -> { final CartDraft cartDraft = CartDraft.of(DefaultCurrencyUnits.EUR).withStore(store.toResourceIdentifier()).withCustomerId(customer.getId()); final CartCreateCommand cartCreateCommand = CartCreateCommand.of(cartDraft); final Cart cart = client().executeBlocking(cartCreateCommand); final Cart cartInStore = client().executeBlocking(CartInStoreByCustomerIdGet.of(store.getKey(), customer.getId())); assertThat(cartInStore).isNotNull(); assertThat(cartInStore.getId()).isEqualTo(cart.getId()); assertThat(cartInStore.getCustomerId()).isEqualTo(customer.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }); }

Target:
public void fetchCartInStoreByCustomerId() { withStore(client(), store -> { CustomerFixtures.withCustomer(client(), customer -> { final CartDraft cartDraft = CartDraft.of(DefaultCurrencyUnits.EUR).withStore(store.toResourceIdentifier()).withCustomerId(customer.getId()); final CartCreateCommand cartCreateCommand = CartCreateCommand.of(cartDraft); final Cart cart = client().executeBlocking(cartCreateCommand); final Cart cartInStore = client().executeBlocking(CartInStoreByCustomerIdGet.of(store.getKey(), customer.getId())); assertThat(cartInStore).isNotNull(); assertThat(cartInStore.getId()).isEqualTo(cart.getId()); assertThat(cartInStore.getCustomerId()).isEqualTo(customer.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }); }
Source:
public void deactivate() { try { shutdown(); metricsConsumer.close(); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }

Target:
public void deactivate() { try { shutdown(); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }
Source:
public MachineDetails getMachineDetails() { MachineDetails details = machineDetails; if (details == null) { synchronized (machineDetailsLock) { details = machineDetails; if (details == null) { machineDetails = details = BasicMachineDetails.forSshMachineLocation(this); } } } return details; }

Target:
public MachineDetails getMachineDetails() { MachineDetails details = machineDetails; if (details == null) { Tasks.setBlockingDetails("Waiting for machine details"); try { synchronized (machineDetailsLock) { details = machineDetails; if (details == null) { machineDetails = details = BasicMachineDetails.forSshMachineLocation(this); } } } finally { Tasks.resetBlockingDetails(); } } return details; }
Source:
private void configureManagementNetwork(SetupNetworksParameters parameters) { VdcReturnValueBase retVal = getBackend().runInternalAction(VdcActionType.SetupNetworks, parameters); if (retVal.getSucceeded()) { retVal = getBackend().runInternalAction(VdcActionType.CommitNetworkChanges, new VdsActionParameters(parameters.getVdsId())); if (!retVal.getSucceeded()) { final AuditLogableBase event = new AuditLogableBase(); event.setVds(host); AuditLogDirector.log(event, AuditLogType.PERSIST_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK, NETWORK_CONFIG_LOG_ERR); throw new NetworkConfiguratorException(MANAGEMENET_NETWORK_CONFIG_ERR); } } else { final AuditLogableBase event = new AuditLogableBase(); event.setVds(host); AuditLogDirector.log(event, AuditLogType.SETUP_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK_CONFIGURATION, NETWORK_CONFIG_LOG_ERR); throw new NetworkConfiguratorException(MANAGEMENET_NETWORK_CONFIG_ERR); } }

Target:
private void configureManagementNetwork(SetupNetworksParameters parameters) { VdcReturnValueBase retVal = getBackend().runInternalAction(VdcActionType.SetupNetworks, parameters); if (retVal.getSucceeded()) { retVal = getBackend().runInternalAction(VdcActionType.CommitNetworkChanges, new VdsActionParameters(parameters.getVdsId())); if (!retVal.getSucceeded()) { AuditLogDirector.log(createEvent(), AuditLogType.PERSIST_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK, NETWORK_CONFIG_LOG_ERR); throw new NetworkConfiguratorException(MANAGEMENET_NETWORK_CONFIG_ERR); } } else { AuditLogDirector.log(createEvent(), AuditLogType.SETUP_NETWORK_FAILED_FOR_MANAGEMENT_NETWORK_CONFIGURATION, NETWORK_CONFIG_LOG_ERR); throw new NetworkConfiguratorException(MANAGEMENET_NETWORK_CONFIG_ERR); } }
Source:
public CTInline addChart(int width, int height,String chartRelId) throws InvalidFormatException, IOException { try { CTDrawing drawing = run.addNewDrawing(); CTInline inline = drawing.addNewInline(); String xml = "<a:graphic xmlns:a=\"" + CTGraphicalObject.type.getName().getNamespaceURI() + "\">" + "<a:graphicData uri=\"" + CTChart.type.getName().getNamespaceURI() + "\">" + "<c:chart xmlns:c=\"" + CTChart.type.getName().getNamespaceURI() + "\" xmlns:r=\"<LINK_0>\" r:id=\""+chartRelId+"\" />" + "</a:graphicData>" + "</a:graphic>"; InputSource is = new InputSource(new StringReader(xml)); org.w3c.dom.Document doc = DocumentHelper.readDocument(is); inline.set(XmlToken.Factory.parse(doc.getDocumentElement(), DEFAULT_XML_OPTIONS)); inline.setDistT(0); inline.setDistR(0); inline.setDistB(0); inline.setDistL(0); CTNonVisualDrawingProps docPr = inline.addNewDocPr(); long id = getParent().getDocument().getDrawingIdManager().reserveNew(); docPr.setId(id); docPr.setName("chart " + id); CTPositiveSize2D extent = inline.addNewExtent(); extent.setCx(width); extent.setCy(height); return inline; } catch (XmlException e) { throw new IllegalStateException(e); } catch (SAXException e) { throw new IllegalStateException(e); } }

Target:
public CTInline addChart(int width, int height,String chartRelId) throws InvalidFormatException, IOException { try { CTInline inline = run.addNewDrawing().addNewInline(); String xml = "<a:graphic xmlns:a=\"" + CTGraphicalObject.type.getName().getNamespaceURI() + "\">" + "<a:graphicData uri=\"" + CTChart.type.getName().getNamespaceURI() + "\">" + "<c:chart xmlns:c=\"" + CTChart.type.getName().getNamespaceURI() + "\" xmlns:r=\"<LINK_0>\" r:id=\""+chartRelId+"\" />" + "</a:graphicData>" + "</a:graphic>"; InputSource is = new InputSource(new StringReader(xml)); org.w3c.dom.Document doc = DocumentHelper.readDocument(is); inline.set(XmlToken.Factory.parse(doc.getDocumentElement(), DEFAULT_XML_OPTIONS)); inline.setDistT(0); inline.setDistR(0); inline.setDistB(0); inline.setDistL(0); CTNonVisualDrawingProps docPr = inline.addNewDocPr(); long id = getParent().getDocument().getDrawingIdManager().reserveNew(); docPr.setId(id); docPr.setName("chart " + id); CTPositiveSize2D extent = inline.addNewExtent(); extent.setCx(width); extent.setCy(height); return inline; } catch (XmlException e) { throw new IllegalStateException(e); } catch (SAXException e) { throw new IllegalStateException(e); } }
Source:
public static int toInteger(String string) { try { return Integer.parseInt(string.replaceAll("[^\\d]", "")); } catch (NumberFormatException ex) { return Integer.MIN_VALUE; } }

Target:
public static int toInteger(String string) throws NumberFormatException{ return Integer.parseInt(string.replaceAll("[^0-9.]", "")); }
Source:
default void inputDetail() { mandatory(directory()); optional(filename()); or(mandatory(host().id()), mandatory(host().name())); }

Target:
default void inputDetail() { or(mandatory(storageDomain().id()), mandatory(storageDomain().name())); optional(exclusive()); }
Source:
private ICPPConstructor getConstructor(IASTDeclaration decl) { if (decl instanceof ICPPASTFunctionDefinition) { ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl; if (functionDefinition.isDeleted()) return null; IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding(); if (binding instanceof ICPPConstructor) { ICPPConstructor constructor = (ICPPConstructor) binding; if (functionDefinition.isDefaulted() && SemanticQueries.isCopyOrMoveConstructor(constructor)) return null; if (constructor.getClassOwner().getKey() == ICompositeType.k_union) return null; for (ICPPASTConstructorChainInitializer memberInitializer : functionDefinition .getMemberInitializers()) { IASTName memberName = memberInitializer.getMemberInitializerId(); if (memberName != null) { IBinding memberBinding = memberName.resolveBinding(); ICPPClassType classType = null; if (memberBinding instanceof ICPPClassType) { classType = (ICPPClassType) memberBinding; } else if (memberBinding instanceof ICPPConstructor) { classType = ((ICPPConstructor) memberBinding).getClassOwner(); } if (classType instanceof ICPPDeferredClassInstance) { classType = ((ICPPDeferredClassInstance) classType).getClassTemplate(); } if (classType != null && classType.isSameType(constructor.getClassOwner())) return null; } } return constructor; } } return null; }

Target:
private ICPPConstructor getConstructor(IASTDeclaration decl) { if (decl instanceof ICPPASTFunctionDefinition) { ICPPASTFunctionDefinition functionDefinition = (ICPPASTFunctionDefinition) decl; if (functionDefinition.isDeleted()) return null; IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding(); if (binding instanceof ICPPConstructor) { ICPPConstructor constructor = (ICPPConstructor) binding; if (functionDefinition.isDefaulted() && SemanticQueries.isCopyOrMoveConstructor(constructor)) return null; if (constructor.getClassOwner().getKey() == ICompositeType.k_union) return null; for (ICPPASTConstructorChainInitializer memberInitializer : functionDefinition .getMemberInitializers()) { IASTName memberName = memberInitializer.getMemberInitializerId(); if (memberName != null) { IBinding memberBinding = memberName.resolveBinding(); ICPPClassType classType = null; if (memberBinding instanceof ICPPConstructor) { classType = ((ICPPConstructor) memberBinding).getClassOwner(); } if (classType instanceof ICPPDeferredClassInstance) { classType = ((ICPPDeferredClassInstance) classType).getClassTemplate(); } if (classType != null && classType.isSameType(constructor.getClassOwner())) return null; } } return constructor; } } return null; }
Source:
private int clipScrollDelta(int currentValue, int delta, int max) { int newValue = currentValue + delta; if (newValue < 0) { delta = -currentValue; } else { if (max < 0) { delta = 0; } else if (newValue > max) { delta = max - currentValue; } } return delta; }

Target:
private int clipScrollDelta(int currentValue, int delta, int max) { int clippedDelta = delta; int newValue = currentValue + delta; if (newValue < 0) { clippedDelta = -currentValue; } else { if (max < 0) { clippedDelta = 0; } else if (newValue > max) { clippedDelta = max - currentValue; } } return clippedDelta; }
Source:
private void assertTopKeyAccesses(String key, long expected, boolean readAccesses) { final CacheUsageInterceptor topK = getTopKey(); eventuallyEquals("Wrong number of accesses.", expected, () -> { Long value = readAccesses ? topK.getLocalTopGets().get(key) : topK.getLocalTopPuts().get(key); return value == null ? 0 : value; }); }

Target:
private void assertTopKeyAccesses(String key, long expected, boolean readAccesses) { final CacheUsageInterceptor topK = getTopKey(); eventuallyEquals("Wrong number of accesses.", expected, () -> readAccesses ? topK.getLocalTopGets().getOrDefault(key, 0L) : topK.getLocalTopPuts().getOrDefault(key, 0L)); }
Source:
public static Text join(Text separator, Text... texts) { switch (texts.length) { case 0: return of(); case 1: return texts[0]; default: TextBuilder builder = builder(); boolean first = true; for (Text text : texts) { if (!first) { builder.append(separator); } else { first = false; } builder.append(text); } return builder.build(); } }

Target:
public static Text join(Text separator, Text... texts) { switch (texts.length) { case 0: return of(); case 1: return texts[0]; default: TextBuilder builder = builder(); boolean appendSeparator = false; for (Text text : texts) { if (appendSeparator) { builder.append(separator); } else { appendSeparator = true; } builder.append(text); } return builder.build(); } }
Source:
public void abortCheckpointOnBarrier(long checkpointId, Throwable cause, OperatorChain<?, ?> operatorChain) throws IOException { LOG.debug("Aborting checkpoint via cancel-barrier for task {}", checkpointId, taskName); checkpointStorage.clearCacheFor(checkpointId); channelStateWriter.abort(checkpointId, cause, true); env.declineCheckpoint(checkpointId, cause); actionExecutor.runThrowing(() -> operatorChain.broadcastEvent(new CancelCheckpointMarker(checkpointId))); }

Target:
public void abortCheckpointOnBarrier(long checkpointId, Throwable cause, OperatorChain<?, ?> operatorChain) throws IOException { LOG.debug("Aborting checkpoint via cancel-barrier for task {}", checkpointId, taskName); lastCheckpointId = Math.max(lastCheckpointId, checkpointId); Iterator<Long> iterator = abortedCheckpointIds.iterator(); while (iterator.hasNext()) { long next = iterator.next(); if (next < lastCheckpointId) { iterator.remove(); } else { break; } } checkpointStorage.clearCacheFor(checkpointId); channelStateWriter.abort(checkpointId, cause, true); env.declineCheckpoint(checkpointId, cause); actionExecutor.runThrowing(() -> operatorChain.broadcastEvent(new CancelCheckpointMarker(checkpointId))); }
Source:
public boolean hasValidJdkLocation() { File javaDir = getJavaDir(); return javaDir != null && JdkLocationStep.validateJdkLocation(javaDir.getAbsolutePath()) == null; }

Target:
public boolean hasValidJdkLocation() { File javaDir = getJavaDir(); return javaDir != null && JdkLocationStep.validateJdkLocation(javaDir) == null; }
Source:
public ChannelWriteController( ApplicationConfigurationFetcher appConfigFetcher, ChannelStore store, ModelReader reader, ChannelModelTransformer channelTransformer ) { this.appConfigFetcher = checkNotNull(appConfigFetcher); this.store = checkNotNull(store); this.reader = checkNotNull(reader); this.channelTransformer = checkNotNull(channelTransformer); }

Target:
private ChannelWriteController( ApplicationConfigurationFetcher appConfigFetcher, ChannelStore store, ModelReader reader, ChannelModelTransformer channelTransformer ) { this.appConfigFetcher = checkNotNull(appConfigFetcher); this.store = checkNotNull(store); this.reader = checkNotNull(reader); this.channelTransformer = checkNotNull(channelTransformer); }
Source:
public V map(String hostname) { if (hostname != null) { hostname = normalize(hostname); V value = map.get(hostname); if (value != null) { return value; } int idx = hostname.indexOf('.'); if (idx != -1) { value = map.get('*' + hostname.substring(idx)); if (value != null) { return value; } } } return defaultValue; }

Target:
public V map(String hostname) { if (hostname != null) { hostname = normalize(hostname); V value = map.get(hostname); if (value != null) { return value; } int idx = hostname.indexOf('.'); if (idx != -1) { value = map.get(hostname.substring(idx)); if (value != null) { return value; } } } return defaultValue; }
Source:
public Diagram getWorkflow() { Process process = modelInstance.getModelElementsByType(Process.class).iterator().next(); return new Diagram(process); }

Target:
public Diagram getWorkflow() throws IOException { Process process = modelInstance.getModelElementsByType(Process.class).iterator().next(); if (Objects.isNull(process)) { throw new IOException("It looks that given file contains invalid BPMN diagram!"); } return new Diagram(process); }
Source:
public void reopenThread() { waitForElementByCss("div.msg-toolbar"); executeScript("document.getElementsByClassName(\"buttons\")[1].style.display = \"block\""); waitForElementByElement(moreButton); mouseOver(moreButtonCss); executeScript("document.querySelectorAll(\"div.msg-toolbar nav.wikia-menu-button.secondary.combined\")[0].click()"); mouseOver(".WikiaMenuElement .reopen-thread"); jQueryNthElemClick(".WikiaMenuElement .reopen-thread", 0); driver.navigate().refresh(); PageObjectLogging.log("reopenThread", "Thread is reopen", true, driver); }

Target:
public void reopenThread() { waitForElementByElement(msgToolbar); setStyle(".buttons", "1", "block"); secondaryCombinedMoreButton.click(); mouseOver(reopenThreadCSS); click(reopenThread); refreshPage(); PageObjectLogging.log("reopenThread", "Thread is reopen", true); }
Source:
public Object lookupPreference(long userId, String key, Object defaultValue) { String methodName = "get" + key.substring(0, 1).toUpperCase() + key.substring(1); Object preference; Object serverPreference = null; Object userPreference = null; try { Method method = null; method = User.class.getMethod(methodName, (Class<?>[]) null); if (method != null) { userPreference = method.invoke(users.get(userId), (Object[]) null); } method = null; method = Server.class.getMethod(methodName, (Class<?>[]) null); if (method != null) { serverPreference = method.invoke(server, (Object[]) null); } } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { return defaultValue; } if (server.getForceSettings()) { preference = serverPreference != null ? serverPreference : userPreference; } else { preference = userPreference != null ? userPreference : serverPreference; } return preference != null ? preference : defaultValue; }

Target:
public Object lookupPreference(long userId, String key, Object defaultValue) { String methodName = "get" + key.substring(0, 1).toUpperCase() + key.substring(1); Object preference; Object serverPreference = null; Object userPreference = null; try { Method method = null; method = User.class.getMethod(methodName, (Class<?>[]) null); if (method != null) { userPreference = method.invoke(users.get(userId), (Object[]) null); } method = null; method = Server.class.getMethod(methodName, (Class<?>[]) null); if (method != null) { serverPreference = method.invoke(server, (Object[]) null); } } catch (ReflectiveOperationException | SecurityException | IllegalArgumentException exception) { return defaultValue; } if (server.getForceSettings()) { preference = serverPreference != null ? serverPreference : userPreference; } else { preference = userPreference != null ? userPreference : serverPreference; } return preference != null ? preference : defaultValue; }
Source:
private void restoreVmConfigFromSnapshot() { snapshotDao.updateStatus(getParameters().getDstSnapshotId(), SnapshotStatus.IN_PREVIEW); snapshotDao.updateStatus(snapshotDao.getId(getVm().getId(), SnapshotType.PREVIEW, SnapshotStatus.LOCKED), SnapshotStatus.OK); getSnapshotsManager().attempToRestoreVmConfigurationFromSnapshot(getVm(), getDstSnapshot(), snapshotDao.getId(getVm().getId(), SnapshotType.ACTIVE), getImagesToPreview(), getCompensationContext(), getCurrentUser(), new VmInterfaceManager(getMacPool()), isRestoreMemory(), isLeaseInfoUpdateNeeded()); if (!isRestoreLease()) { vmStaticDao.updateVmLeaseStorageDomainId(getVm().getId(), null); } if (getParameters().getDstLeaseDomainId() != null && !getParameters().getDstLeaseDomainId() .equals(OvfUtils.fetchLeaseDomainId(getDstSnapshot().getVmConfiguration()))) { vmStaticDao.updateVmLeaseStorageDomainId(getVm().getId(), getParameters().getDstLeaseDomainId()); } }

Target:
private void restoreVmConfigFromSnapshot() { snapshotDao.updateStatus(getParameters().getDstSnapshotId(), SnapshotStatus.IN_PREVIEW); snapshotDao.updateStatus(snapshotDao.getId(getVm().getId(), SnapshotType.PREVIEW, SnapshotStatus.LOCKED), SnapshotStatus.OK); getSnapshotsManager().attempToRestoreVmConfigurationFromSnapshot(getVm(), getDstSnapshot(), snapshotDao.getId(getVm().getId(), SnapshotType.ACTIVE), getImagesToPreview(), getCompensationContext(), getCurrentUser(), new VmInterfaceManager(getMacPool()), isRestoreMemory(), isLeaseInfoUpdateNeeded()); if (!isRestoreLease()) { vmStaticDao.updateVmLeaseStorageDomainId(getVm().getId(), null); } Guid dstLeaseStorageDomainId = OvfUtils.fetchLeaseDomainId(getDstSnapshot().getVmConfiguration()); if (getParameters().getDstLeaseDomainId() != null && !getParameters().getDstLeaseDomainId() .equals(dstLeaseStorageDomainId)) { vmStaticDao.updateVmLeaseStorageDomainId(getVm().getId(), getParameters().getDstLeaseDomainId()); } }
Source:
public void abortProcessInstances(String serverTemplateId, Map<String, List<Long>> containerInstances) { ProcessServicesClient client = getClient(serverTemplateId, ProcessServicesClient.class); containerInstances.entrySet().stream().forEach((entry -> { client.abortProcessInstances(entry.getKey(), entry.getValue()); })); }

Target:
public void abortProcessInstances(String serverTemplateId, Map<String, List<Long>> containerInstances) { ProcessServicesClient client = getClient(serverTemplateId, ProcessServicesClient.class); containerInstances.forEach((container, instances) -> client.abortProcessInstances(container, instances) ); }
Source:
public void parseChildren(final XMLExtendedStreamReader reader, PathAddress parentAddress, List<ModelNode> list, ModelNode op) throws XMLStreamException { if (children.size() == 0) { if (flushRequired && attributeGroups.isEmpty() && attributeElements.isEmpty()) { ParseUtils.requireNoContent(reader); } if (childAlreadyRead) { throw ParseUtils.unexpectedElement(reader); } } else { Map<String, PersistentResourceXMLDescription> children = getChildrenMap(); if (childAlreadyRead) { PersistentResourceXMLDescription decoratorChild = children.get(reader.getLocalName()); if (decoratorChild != null && decoratorChild.decoratorElement != null) { decoratorChild.parseDecorator(reader, parentAddress, list); } } if (childAlreadyRead || (reader.hasNext() && reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { do { PersistentResourceXMLDescription child = children.get(reader.getLocalName()); if (child != null) { child.parse(reader, parentAddress, list); } else if (attributeElements.containsKey(reader.getLocalName())) { AttributeDefinition ad = attributeElements.get(reader.getLocalName()); ad.getParser().parseElement(ad, reader, op); } else if (customChildParsers.containsKey(reader.getLocalName())) { customChildParsers.get(reader.getLocalName()).parse(reader, parentAddress, list); } else { throw ParseUtils.unexpectedElement(reader, children.keySet()); } } while (reader.hasNext() && reader.nextTag() != XMLStreamConstants.END_ELEMENT); } } }

Target:
private void parseChildren(final XMLExtendedStreamReader reader, PathAddress parentAddress, List<ModelNode> list, ModelNode op) throws XMLStreamException { if (children.size() == 0) { if (flushRequired && attributeGroups.isEmpty() && attributeElements.isEmpty()) { ParseUtils.requireNoContent(reader); } if (childAlreadyRead) { throw ParseUtils.unexpectedElement(reader); } } else { Map<String, PersistentResourceXMLDescription> children = getChildrenMap(); if (childAlreadyRead) { PersistentResourceXMLDescription decoratorChild = children.get(reader.getLocalName()); if (decoratorChild != null && decoratorChild.decoratorElement != null) { decoratorChild.parseDecorator(reader, parentAddress, list); } } if (childAlreadyRead || (reader.hasNext() && reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { do { PersistentResourceXMLDescription child = children.get(reader.getLocalName()); if (child != null) { child.parse(reader, parentAddress, list); } else if (attributeElements.containsKey(reader.getLocalName())) { AttributeDefinition ad = attributeElements.get(reader.getLocalName()); ad.getParser().parseElement(ad, reader, op); } else if (customChildParsers.containsKey(reader.getLocalName())) { customChildParsers.get(reader.getLocalName()).parse(reader, parentAddress, list); } else { throw ParseUtils.unexpectedElement(reader, children.keySet()); } } while (reader.hasNext() && reader.nextTag() != XMLStreamConstants.END_ELEMENT); } } }
Source:
public String sendAddOperation(String userid, Collection<PID> destinations, Collection<PID> added, Collection<PID> reordered, String depositId) { Element contentEl = createAtomEntry(userid, destinations.iterator().next(), CDRActions.ADD); Element add = new Element("add", CDR_MESSAGE_NS); contentEl.addContent(add); if (depositId != null) { add.addContent(new Element("depositId", CDR_MESSAGE_NS).setText(depositId)); } for (PID destination : destinations) { add.addContent(new Element("parent", CDR_MESSAGE_NS).setText(destination.toString())); } Element subjects = new Element("subjects", CDR_MESSAGE_NS); add.addContent(subjects); for (PID sub : added) { subjects.addContent(new Element("pid", CDR_MESSAGE_NS).setText(sub.toString())); } if (reordered != null) { Element reorderedEl = new Element("reordered", CDR_MESSAGE_NS); add.addContent(reorderedEl); for (PID re : reordered) { reorderedEl.addContent(new Element("pid", CDR_MESSAGE_NS).setText(re.toString())); } } Document msg = contentEl.getDocument(); sendMessage(msg); LOG.debug("sent add operation JMS message using JMS template: {}", this.getJmsTemplate()); return getMessageId(msg); }

Target:
public String sendAddOperation(String userid, Collection<PID> destinations, Collection<PID> added, Collection<PID> reordered, String depositId) { Element contentEl = createAtomEntry(userid, destinations.iterator().next(), CDRActions.ADD); Element add = new Element("add", CDR_MESSAGE_NS); contentEl.addContent(add); if (depositId != null) { add.addContent(new Element("depositId", CDR_MESSAGE_NS).setText(depositId)); } for (PID destination : destinations) { add.addContent(new Element("parent", CDR_MESSAGE_NS).setText(destination.getRepositoryPath())); } Element subjects = new Element("subjects", CDR_MESSAGE_NS); add.addContent(subjects); for (PID sub : added) { subjects.addContent(new Element("pid", CDR_MESSAGE_NS).setText(sub.getRepositoryPath())); } if (reordered != null) { Element reorderedEl = new Element("reordered", CDR_MESSAGE_NS); add.addContent(reorderedEl); for (PID re : reordered) { reorderedEl.addContent(new Element("pid", CDR_MESSAGE_NS).setText(re.getRepositoryPath())); } } Document msg = contentEl.getDocument(); sendMessage(msg); LOG.debug("sent add operation JMS message using JMS template: {}", this.getJmsTemplate()); return getMessageId(msg); }
Source:
public void visit(AssignNode assignNode) { super.visit(assignNode); String var = assignNode.getVariable().getName(); try { VarDeclNode decl = scope.getVarDeclNode(var); if (decl.isMethodVariable()) { mv.visitInsn(DUP); mv.visitVarInsn(ASTORE, 1 + decl.getOffset()); } else if (decl.isClassField()) { System.out.println("Putting field: " + decl.getName()); mv.visitVarInsn(ALOAD, 0); mv.visitFieldInsn(PUTFIELD, ((ClazzNode) decl.getScope().getNode()).getName(), decl.getName(), "Lorg/twnc/runtime/BObject;"); } else { System.out.println("Should not happen?"); } } catch (VariableNotDeclaredException e) { e.printStackTrace(); } }

Target:
public void visit(AssignNode assignNode) { super.visit(assignNode); String var = assignNode.getVariable().getName(); try { VarDeclNode decl = scope.getVarDeclNode(var); if (decl.isMethodVariable()) { mv.visitInsn(DUP); mv.visitVarInsn(ASTORE, 1 + decl.getOffset()); } else if (decl.isClassField()) { mv.visitVarInsn(ALOAD, 0); mv.visitInsn(SWAP); mv.visitFieldInsn(PUTFIELD, ((ClazzNode) decl.getScope().getNode()).getName(), decl.getName(), "Lorg/twnc/runtime/BObject;"); } else { throw new UnknownVariableDeclarationLocation(); } } catch (VariableNotDeclaredException e) { e.printStackTrace(); } }
Source:
public synchronized int read(byte[] b, int off, int len) throws IOException { if (len == 0) return len; len = (int)getMaxRead(remoteOffset, len); if (len == 0) return -1; try { outStream.write(("READ " + remoteOffset + " " + len + "\r\n").getBytes(Sage.BYTE_CHARSET)); inStream.readFully(b, off, len); outStream.flush(); } catch (IOException e) { reconnect(); outStream.write(("READ " + remoteOffset + " " + len + "\r\n").getBytes(Sage.BYTE_CHARSET)); inStream.readFully(b, off, len); outStream.flush(); } remoteOffset += len; return len; }

Target:
public synchronized int read(byte[] b, int off, int len) throws IOException { if (len == 0) return len; len = (int)getMaxRead(remoteOffset, len); if (len == 0) return -1; try { outStream.write(("READ " + remoteOffset + " " + len + "\r\n").getBytes(Sage.BYTE_CHARSET)); outStream.flush(); inStream.readFully(b, off, len); } catch (IOException e) { reconnect(); outStream.write(("READ " + remoteOffset + " " + len + "\r\n").getBytes(Sage.BYTE_CHARSET)); outStream.flush(); inStream.readFully(b, off, len); } remoteOffset += len; return len; }
Source:
public static void listJobs(String projectId, String location) throws IOException { try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) { var listJobsRequest = ListJobsRequest.newBuilder() .setParent(LocationName.of(projectId, location).toString()) .build(); TranscoderServiceClient.ListJobsPagedResponse response = transcoderServiceClient.listJobs(listJobsRequest); System.out.println("Jobs:"); for (Job jt : response.iterateAll()) { System.out.println(jt); } } }

Target:
public static void listJobs(String projectId, String location) throws IOException { try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) { var listJobsRequest = ListJobsRequest.newBuilder() .setParent(LocationName.of(projectId, location).toString()) .build(); TranscoderServiceClient.ListJobsPagedResponse response = transcoderServiceClient.listJobs(listJobsRequest); System.out.println("Jobs:"); for (Job job : response.iterateAll()) { System.out.println(job.getName()); } } }
Source:
protected void execute() { long lastSend = controller.getLastSend(); logger.info("Check thread current idle ms "+(System.currentTimeMillis() - lastSend)); if ((System.currentTimeMillis() - lastSend) > restartTimeout) { resetTellstick(); } if ((System.currentTimeMillis() - lastRefresh) > updateFromTellstickInterval) { refreshFromTellstick(); } }

Target:
protected void execute() { long lastSend = controller.getLastSend(); logger.trace("Check thread current idle ms " + (System.currentTimeMillis() - lastSend)); if ((System.currentTimeMillis() - lastSend) > restartTimeout) { resetTellstick(); } if ((System.currentTimeMillis() - lastRefresh) > updateFromTellstickInterval) { refreshFromTellstick(); } }