auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <L> void receivedEvent(AvailEvent<L> event) { MonitoredEndpoint<EndpointConfiguration> endpoint = event.getSamplingService().getMonitoredEndpoint(); String endpointTenantId = endpoint.getEndpointConfiguration().getTenantId(); String tenantId = (null != endpointTenantId) ? endpointTenantId : storageAdapter.getStorageAdapterConfiguration().getTenantId(); event.getChanged().keySet().stream() .filter(mi -> mi.getResource().getResourceType().getNotifications().contains(NotificationType.AVAIL_CHANGE)) .forEach(mi -> { CanonicalPath cp = CanonicalPath.of() .tenant(tenantId) .feed(feedId) .resource(mi.getResource().getID().getIDString()) .get(); try { NotificationPayloadBuilder b = storageAdapter.createNotificationPayloadBuilder(); b.addNotificationType(NotificationType.AVAIL_CHANGE); b.addProperty("resourceType", mi.getResource().getResourceType().getName().getNameString()); b.addProperty("resourcePath", cp.toString()); b.addProperty("availType", mi.getType().getName().getNameString()); b.addProperty("newAvail", event.getChanged().get(mi).name()); storageAdapter.store(b, 0); } catch (Exception e) { } }); }

Target:
public <L> void receivedEvent(AvailEvent<L> event) { MonitoredEndpoint<EndpointConfiguration> endpoint = event.getSamplingService().getMonitoredEndpoint(); String endpointTenantId = endpoint.getEndpointConfiguration().getTenantId(); String tenantId = (null != endpointTenantId) ? endpointTenantId : storageAdapter.getStorageAdapterConfiguration().getTenantId(); processAvailEvents(event.getChanged(), NotificationType.AVAIL_CHANGE, tenantId); processAvailEvents(event.getStarted(), NotificationType.AVAIL_STARTING, tenantId); }
Source:
public void exposeHostPort(int hostPort, int containerPort) { if (exposedPorts.add(hostPort)) { getSshConnection().requestRemotePortForwarding("", containerPort, "localhost", hostPort); } }

Target:
public void exposeHostPort(int hostPort, int containerPort) { if (exposedPorts.add(new AbstractMap.SimpleEntry<>(hostPort, containerPort))) { getSshConnection().requestRemotePortForwarding("", containerPort, "localhost", hostPort); } }
Source:
public void checkSpecificAccessControl() { if (!userInfo.isInstructor) { throw new UnauthorizedAccessException("Instructor privilege is required to access this resource."); } String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT); }

Target:
public void checkSpecificAccessControl() { if (!userInfo.isInstructor) { throw new UnauthorizedAccessException("Instructor privilege is required to access this resource."); } String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT); }
Source:
public Map<K, V> getEntries() { return (Map<K, V>) entries; }

Target:
public Map<? extends K, ? extends V> getEntries() { return entries; }
Source:
public void testMenuNoMarkerSet() { SWTBotRootMenu viewMenu = fViewBot.viewMenu(); List<String> menuItems = viewMenu.menu("Marker Set").menuItems(); assertEquals("number of items", 3, menuItems.size()); assertArrayEquals("menu items, no marker set", MENU_ITEMS_NO_MARKERS_SET, menuItems.toArray()); }

Target:
public void testMenuNoMarkerSet() { SWTBotRootMenu viewMenu = fViewBot.viewMenu(); List<String> menuItems = viewMenu.menu("Marker Set").menuItems(); assertArrayEquals("menu items, no marker set", MENU_ITEMS_NO_MARKERS_SET, menuItems.toArray()); }
Source:
public static boolean isConstant(Expr expr) { return expr instanceof DoubleExpr || expr instanceof LongExpr || expr instanceof StringExpr; }

Target:
public static boolean isConstant(Expr expr) { return expr instanceof ConstantExpr; }
Source:
private void logRenamedEntity() { if (this instanceof RenamedEntityInfoProvider) { String entity="UNKNOWN"; String oldName=""; String newName=""; try { entity = ReflectionUtils.getMethodValue(this, "getEntityName").toString(); oldName = ReflectionUtils.getMethodValue(this, "getOldName").toString(); newName = ReflectionUtils.getMethodValue(this, "getNewName").toString(); if (!oldName.equals(newName)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("EntityName", entity); logable.AddCustomValue("OldName", oldName); logable.AddCustomValue("NewName", newName); Class<AuditLogableBase> partypes[] = new Class[1]; partypes[0] = AuditLogableBase.class; Object arglist[] = new Object[1]; arglist[0] = logable; ReflectionUtils.callMethod(this, "setId", partypes, arglist); AuditLogDirector.log(logable, AuditLogType.ENTITY_RENAMED); } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }

Target:
private void logRenamedEntity() { try { if (this instanceof RenamedEntityInfoProvider) { String oldEntityName; String newEntityName; RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String entityType = renameable.getEntityType(); oldEntityName = renameable.getEntityOldName(); newEntityName = renameable.getEntityNewName(); if (!oldEntityName.equals(newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("EntityType", entityType); logable.AddCustomValue("OldEntityName", oldEntityName); logable.AddCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); AuditLogDirector.log(logable, AuditLogType.ENTITY_RENAMED); } } } catch (Exception e) { log.error(e.getMessage()); log.debug("Failed to log entity rename operation.", e); } }
Source:
private static Properties loadLibraryProperties(@Nonnull InputVFS vfs) throws NotJackLibraryException { Properties libraryProperties = new Properties(); try { InputVFile libProp = vfs.getRootInputVDir().getInputVFile(JackLibrary.LIBRARY_PROPERTIES_VPATH); InputStream inputStream = null; try { inputStream = libProp.getInputStream(); libraryProperties.load(inputStream); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { logger.log( Level.WARNING, "Failed to close ''{0}''", libProp.getLocation().getDescription()); } } } } catch (NotFileOrDirectoryException | NoSuchFileException | WrongPermissionException e) { throw new NotJackLibraryException(vfs.getLocation()); } catch (IOException e) { throw new NotJackLibraryException(vfs.getLocation()); } return libraryProperties; }

Target:
private static Properties loadLibraryProperties(@Nonnull InputVFS vfs) throws NotJackLibraryException { Properties libraryProperties = new Properties(); try { InputVFile libProp = vfs.getRootInputVDir().getInputVFile(JackLibrary.LIBRARY_PROPERTIES_VPATH); InputStream inputStream = null; try { inputStream = libProp.getInputStream(); libraryProperties.load(inputStream); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { logger.log( Level.WARNING, "Failed to close ''{0}''", libProp.getLocation().getDescription()); } } } } catch (IOException | NotFileOrDirectoryException | NoSuchFileException | WrongPermissionException e) { throw new NotJackLibraryException(vfs.getLocation()); } return libraryProperties; }
Source:
public boolean rewrite(File f) throws InvalidKeyException, IOException { AtomicFileWriter w = new AtomicFileWriter(f, "UTF-8"); try { boolean modified = false; try (PrintWriter out = new PrintWriter(new BufferedWriter(w)); InputStream fin = Files.newInputStream(f.toPath()); BufferedReader r = new BufferedReader(new InputStreamReader(fin, StandardCharsets.UTF_8))) { String line; StringBuilder buf = new StringBuilder(); while ((line = r.readLine()) != null) { int copied = 0; buf.setLength(0); while (true) { int sidx = line.indexOf('>', copied); if (sidx < 0) break; int eidx = line.indexOf('<', sidx); if (eidx < 0) break; String elementText = line.substring(sidx + 1, eidx); String replacement = tryRewrite(elementText); if (!replacement.equals(elementText)) modified = true; buf.append(line, copied, sidx + 1); buf.append(replacement); copied = eidx; } buf.append(line.substring(copied)); out.println(buf.toString()); } } catch (InvalidPathException e) { throw new IOException(e); } if (modified) { w.commit(); } return modified; } finally { w.abort(); } }

Target:
public boolean rewrite(File f) throws InvalidKeyException, IOException { AtomicFileWriter w = new AtomicFileWriter(f, "UTF-8"); try { boolean modified = false; try (PrintWriter out = new PrintWriter(new BufferedWriter(w)); InputStream fin = Files.newInputStream(Util.fileToPath(f)); BufferedReader r = new BufferedReader(new InputStreamReader(fin, StandardCharsets.UTF_8))) { String line; StringBuilder buf = new StringBuilder(); while ((line = r.readLine()) != null) { int copied = 0; buf.setLength(0); while (true) { int sidx = line.indexOf('>', copied); if (sidx < 0) break; int eidx = line.indexOf('<', sidx); if (eidx < 0) break; String elementText = line.substring(sidx + 1, eidx); String replacement = tryRewrite(elementText); if (!replacement.equals(elementText)) modified = true; buf.append(line, copied, sidx + 1); buf.append(replacement); copied = eidx; } buf.append(line.substring(copied)); out.println(buf.toString()); } } if (modified) { w.commit(); } return modified; } finally { w.abort(); } }
Source:
private void storeEvent(Map<String, Object> event, Date timestamp) { try { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); ObjectMapper m = new ObjectMapper(); StringWriter w = new StringWriter(); m.writeValue(w, event); Entity entity = new Entity("EventQueue"); entity.setProperty("createdDateTime", timestamp); entity.setProperty("lastUpdateDateTime", timestamp); String payload = w.toString(); if (payload.length() > Constants.MAX_LENGTH) { entity.setProperty("payloadText", new Text(payload)); } else { entity.setProperty("payload", w.toString()); } datastore.put(entity); notifyLog(); } catch (Exception e) { logger.log(Level.SEVERE, "could not store " + event.get("eventType") + " event. Error: " + e.toString(), e); } }

Target:
private void storeEvent(Map<String, Object> event, Date timestamp) { try { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); ObjectMapper m = new ObjectMapper(); StringWriter w = new StringWriter(); m.writeValue(w, event); Entity entity = new Entity("EventQueue"); entity.setProperty("createdDateTime", timestamp); entity.setProperty("lastUpdateDateTime", timestamp); String payload = w.toString(); if (payload.length() > Constants.MAX_LENGTH) { entity.setProperty("payloadText", new Text(payload)); } else { entity.setProperty("payload", payload); } datastore.put(entity); notifyLog(); } catch (Exception e) { logger.log(Level.SEVERE, "could not store " + event.get("eventType") + " event. Error: " + e.toString(), e); } }
Source:
public void prompt(PrintStream out) { int maxLength = String.valueOf(mChoices.length).length(); out.println(CliUtils.pad("", maxLength + 1) + mHeader); out.println("=============================================================================================="); int i; for (i = 0; i < mChoices.length; ++i) { String d = rows[i]; out.println(CliUtils.pad(String.valueOf(i), maxLength) + ")" + d); } if(mAction != null) { out.println(); out.println("action) " + mAction.getDisplay().evaluate().getName()); } }

Target:
public void prompt(PrintStream out) { int maxLength = String.valueOf(mChoices.length).length(); out.println(CliUtils.pad("", maxLength + 1) + mHeader); out.println("=============================================================================================="); for (int i = 0; i < mChoices.length; ++i) { String d = rows[i]; out.println(CliUtils.pad(String.valueOf(i), maxLength) + ")" + d); } if(mAction != null) { out.println(); out.println("action) " + mAction.getDisplay().evaluate().getName()); } }
Source:
public void removeTask(@NotNull final String taskId, Protos.TaskStatus status) { List<CassandraNode> nodes = clusterState.nodes(); List<CassandraNode> newNodes = new ArrayList<>(nodes.size()); boolean changed = false; for (CassandraNode cassandraNode : nodes) { CassandraNodeTask nodeTask = CassandraFrameworkProtosUtils.getTaskForNode(cassandraNode, taskId); if (nodeTask == null) { newNodes.add(cassandraNode); continue; } CassandraNode.Builder builder = CassandraFrameworkProtosUtils.removeTask(cassandraNode, nodeTask); changed = true; switch (nodeTask.getTaskType()) { case METADATA: removeExecutorMetadata(nodeTask.getExecutorId()); builder.clearTasks(); break; case SERVER: changed = true; break; } newNodes.add(builder.build()); } if (changed) clusterState.nodes(newNodes); ClusterJobStatus clusterJob = getCurrentClusterJob(); if (clusterJob != null) { if (clusterJob.hasCurrentNode() && clusterJob.getCurrentNode().getTaskId().equals(taskId)) { jobsState.removeTaskForCurrentNode(status, clusterJob); } } }

Target:
public void removeTask(@NotNull final String taskId, Protos.TaskStatus status) { List<CassandraNode> nodes = clusterState.nodes(); List<CassandraNode> newNodes = new ArrayList<>(nodes.size()); boolean changed = false; for (CassandraNode cassandraNode : nodes) { CassandraNodeTask nodeTask = CassandraFrameworkProtosUtils.getTaskForNode(cassandraNode, taskId); if (nodeTask == null) { newNodes.add(cassandraNode); continue; } CassandraNode.Builder builder = CassandraFrameworkProtosUtils.removeTask(cassandraNode, nodeTask); changed = true; switch (nodeTask.getTaskType()) { case METADATA: removeExecutorMetadata(nodeTask.getExecutorId()); builder.clearTasks(); break; case SERVER: builder.clearCassandraDaemonPid(); break; } newNodes.add(builder.build()); } if (changed) { clusterState.nodes(newNodes); } ClusterJobStatus clusterJob = getCurrentClusterJob(); if (clusterJob != null) { if (clusterJob.hasCurrentNode() && clusterJob.getCurrentNode().getTaskId().equals(taskId)) { jobsState.removeTaskForCurrentNode(status, clusterJob); } } }
Source:
public boolean containsPoint(float x, float y) { return x >= this.minX && y >= this.minY && x <= this.maxX && y <= this.maxY; }

Target:
public boolean containsPoint(float x, float y) { return x > this.minX && y > this.minY && x < this.maxX && y < this.maxY; }
Source:
public Map<String, String> getCoordinates() { return new HashMap<>(coordinates); }

Target:
public Map<String, String> getCoordinates() { return new LinkedHashMap<>(coordinates); }
Source:
private static boolean isNestingBroken(ConditionalExpressionTree conditionalExpression) { Tree parent = ((JavaScriptTree) conditionalExpression).getParent(); while (!parent.is(Kind.CONDITIONAL_EXPRESSION)) { if (breaksRecursion(parent)) { return true; } parent = ((JavaScriptTree) parent).getParent(); } return false; }

Target:
private static boolean isNestingBroken(ConditionalExpressionTree conditionalExpression) { Tree parent = ((JavaScriptTree) conditionalExpression).getParent(); while (!parent.is(Kind.CONDITIONAL_EXPRESSION)) { if (breaksNesting(parent)) { return true; } parent = CheckUtils.parent(parent); } return false; }
Source:
public void onApplicationEvent(ScalingEvent event) { Set<BaseAlert> alerts = event.getAlerts(); Long clusterId = alerts.stream().findFirst().map(ma -> ma.getCluster().getId()).orElseThrow(); Cluster cluster = clusterService.findById(clusterId); MDCBuilder.buildMdcContext(cluster); if (isCooldownElapsed(cluster)) { alerts.forEach(alert -> scale(cluster, alert.getScalingPolicy())); } }

Target:
public void onApplicationEvent(ScalingEvent event) { List<BaseAlert> alerts = event.getAlerts(); Long clusterId = alerts.stream().findFirst().map(ma -> ma.getCluster().getId()).orElseThrow(); Cluster cluster = clusterService.findById(clusterId); MDCBuilder.buildMdcContext(cluster); alerts.forEach(alert -> { if (scalingHandlerUtil.isCooldownElapsed(cluster)) { scalingHandlerUtil.scaleIfNeed(cluster, alert); } }); }
Source:
private JacksonIterator(Type type, ObjectMapper mapper, Response response, Reader reader) throws IOException { this.response = response; this.parser = mapper.getFactory().createParser(reader); this.objectReader = mapper.reader().forType(mapper.constructType(type)); }

Target:
JacksonIterator(Type type, ObjectMapper mapper, Response response, Reader reader) throws IOException { this.response = response; this.parser = mapper.getFactory().createParser(reader); this.objectReader = mapper.reader().forType(mapper.constructType(type)); }
Source:
public static Context setSpanName(String spanName, Context context) { if (TRACER == null) { return context; } return TRACER.setSpanName(spanName, context); }

Target:
public static Context setSpanName(String spanName, Context context) { if (tracer == null) { return context; } return tracer.setSpanName(spanName, context); }
Source:
public void testNonBlockingConnectionManagerInstantiationBadInputs() { try { connectionManager = new NonBlockingConnectionManager(null, networkConfig, routerConfig.routerMaxConnectionsPerPortPlainText, routerConfig.routerMaxConnectionsPerPortSsl, time); Assert.fail(); } catch (IllegalArgumentException e) { } try { connectionManager = new NonBlockingConnectionManager(selector, null, routerConfig.routerMaxConnectionsPerPortPlainText, routerConfig.routerMaxConnectionsPerPortSsl, time); Assert.fail(); } catch (IllegalArgumentException e) { } }

Target:
public void testNonBlockingConnectionManagerInstantiationBadInputs() { try { connectionManager = new NonBlockingConnectionManager(null, networkConfig, routerConfig.routerScalingUnitMaxConnectionsPerPortPlainText, routerConfig.routerScalingUnitMaxConnectionsPerPortSsl, time); Assert.fail("NonBlockingConnectionManager should not get constructed with a null Selector"); } catch (IllegalArgumentException e) { } try { connectionManager = new NonBlockingConnectionManager(selector, null, routerConfig.routerScalingUnitMaxConnectionsPerPortPlainText, routerConfig.routerScalingUnitMaxConnectionsPerPortSsl, time); Assert.fail("NonBlockingConnectionManager should not get constructed with a null NetworkConfig"); } catch (IllegalArgumentException e) { } }
Source:
private static boolean isSupportedSpatialFunction(FunctionCall functionCall) { String functionName = functionCall.getName().getSuffix(); for (FullyQualifiedName allowedName : ALLOWED_SPATIAL_JOIN_FUNCTIONS) { if (functionName.equalsIgnoreCase(allowedName.getSuffix())) { return true; } } return false; }

Target:
private static boolean isSupportedSpatialFunction(FunctionCall functionCall) { String functionName = functionCall.getName().getSuffix().toLowerCase(ENGLISH); return ALLOWED_SPATIAL_JOIN_FUNCTIONS.contains(functionName); }
Source:
private KeyStore loadKeyStore(String keyStorePath, char[] keyStorePassword) throws SecureVaultException { Path keyStoreFileLocation; if (SecureVaultDataHolder.getInstance().getBundleContext().isPresent()) { keyStoreFileLocation = Paths.get(SecureVaultUtils.getCarbonHome().get().toString(), keyStorePath); } else { keyStoreFileLocation = Paths.get(keyStorePath); } try (BufferedInputStream bufferedInputStream = new BufferedInputStream( new FileInputStream(keyStoreFileLocation.toString()))) { KeyStore keyStore; try { keyStore = KeyStore.getInstance(JKS); keyStore.load(bufferedInputStream, keyStorePassword); logger.debug("Keystore at path : '{}', loaded successfully.", keyStorePath); return keyStore; } catch (CertificateException e) { throw new SecureVaultException("Failed to load certificates from keystore : '" + keyStorePath + "'", e); } catch (NoSuchAlgorithmException e) { throw new SecureVaultException("Failed to load keystore algorithm at : '" + keyStorePath + "'", e); } catch (KeyStoreException e) { throw new SecureVaultException("Failed to initialize keystore at : '" + keyStorePath + "'", e); } } catch (IOException e) { throw new SecureVaultException("Unable to find keystore at '" + keyStorePath + "'", e); } }

Target:
private KeyStore loadKeyStore(String keyStorePath, char[] keyStorePassword) throws SecureVaultException { Path keyStoreFileLocation; if (SecureVaultUtils.isOSGIEnv()) { keyStoreFileLocation = Paths.get(SecureVaultUtils.getCarbonHome().get().toString(), keyStorePath); } else { keyStoreFileLocation = Paths.get(keyStorePath); } try (BufferedInputStream bufferedInputStream = new BufferedInputStream( new FileInputStream(keyStoreFileLocation.toString()))) { KeyStore keyStore; try { keyStore = KeyStore.getInstance(JKS); keyStore.load(bufferedInputStream, keyStorePassword); logger.debug("Keystore at path : '{}', loaded successfully.", keyStorePath); return keyStore; } catch (CertificateException e) { throw new SecureVaultException("Failed to load certificates from keystore : '" + keyStorePath + "'", e); } catch (NoSuchAlgorithmException e) { throw new SecureVaultException("Failed to load keystore algorithm at : '" + keyStorePath + "'", e); } catch (KeyStoreException e) { throw new SecureVaultException("Failed to initialize keystore at : '" + keyStorePath + "'", e); } } catch (IOException e) { throw new SecureVaultException("Unable to find keystore at '" + keyStorePath + "'", e); } }
Source:
private void simpleScanAsPomFile(File file, Document document) { MavenProject project = MavenParser.parseXML(file); MavenFileScannerContext mavenContext = new MavenFileScannerContextImpl(project, document, file, sonarComponents); if (project != null) { for (MavenFileScanner mavenFileScanner : mavenFileScanners) { mavenFileScanner.scanFile(mavenContext); } } }

Target:
private void simpleScanAsPomFile(File file, Document document) { MavenProject project = PomParser.parseXML(file); if (project != null) { PomCheckContext context = new PomCheckContextImpl(project, document, file, sonarComponents); for (PomCheck check : pomChecks) { check.scanFile(context); } } }
Source:
public void testChangingCurrentThreadCLINotification() throws Throwable { ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fMultiRunControl.getSession(), MIStoppedEvent.class); SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false); SyncUtil.addBreakpoint("36", false); SyncUtil.resumeAll(); eventWaitor.waitForEvent(2000); eventWaitor.waitForEvent(2000); eventWaitor.waitForEvent(2000); eventWaitor.waitForEvent(2000); eventWaitor.waitForEvent(2000); for (int i = 0; i < 2; i++) { assertEquals("2",switchThreadAndCaptureThreadSwitchedEvent("2")); assertEquals("3",switchThreadAndCaptureThreadSwitchedEvent("3")); assertEquals("4",switchThreadAndCaptureThreadSwitchedEvent("4")); assertEquals("5",switchThreadAndCaptureThreadSwitchedEvent("5")); assertEquals("1",switchThreadAndCaptureThreadSwitchedEvent("1")); assertEquals("1",switchThreadAndCaptureThreadSwitchedEvent("1")); } }

Target:
public void testChangingCurrentThreadCLINotification() throws Throwable { ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<MIStoppedEvent>(fMultiRunControl.getSession(), MIStoppedEvent.class); SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false); SyncUtil.addBreakpoint("36", false); SyncUtil.resumeAll(); eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); for (int i = 0; i < 2; i++) { assertEquals("2",switchThreadAndCaptureThreadSwitchedEvent("2")); assertEquals("3",switchThreadAndCaptureThreadSwitchedEvent("3")); assertEquals("4",switchThreadAndCaptureThreadSwitchedEvent("4")); assertEquals("5",switchThreadAndCaptureThreadSwitchedEvent("5")); assertEquals("1",switchThreadAndCaptureThreadSwitchedEvent("1")); assertEquals("1",switchThreadAndCaptureThreadSwitchedEvent("1")); } }
Source:
private void refreshView() { try { String[] headers = new String[shortSelect.getFields().length]; for (int i = 0; i < headers.length; ++i) { headers[i] = shortSelect.getFields()[i].getHeader().evaluate(); if ("address".equals(shortSelect.getFields()[i].getTemplateForm())) { this.mMappingEnabled = true; } } header.removeAllViews(); if (!shortSelect.usesGridView()) { EntityView v = new EntityView(this, shortSelect, headers); header.addView(v); } if (adapter == null) { loadEntities(); } else { startTimer(); } } catch (RuntimeException re) { createErrorDialog(re.getMessage(), true); } }

Target:
private void refreshView() { try { String[] headers = new String[shortSelect.getFields().length]; for (int i = 0; i < headers.length; ++i) { headers[i] = shortSelect.getFields()[i].getHeader().evaluate(); if ("address".equals(shortSelect.getFields()[i].getTemplateForm())) { this.mMappingEnabled = true; } } header.removeAllViews(); if (!shortSelect.usesGridView()) { EntityView v = EntityView.buildHeadersEntityView(this, shortSelect, headers); header.addView(v); } if (adapter == null) { loadEntities(); } else { startTimer(); } } catch (RuntimeException re) { createErrorDialog(re.getMessage(), true); } }
Source:
private void processGeneratedExpressionColumn(Reference reference, Input<?> expressionInput) { toInject.put(reference, expressionInput); final ColumnIdent ident = reference.column(); if (!ident.isTopLevel()) { List<Reference> references = nestedReferenceByTopLevelColumnName.getOrDefault( ident.name(), new ArrayList<>()); references.add(reference); nestedReferenceByTopLevelColumnName.put(ident.name(), references); } }

Target:
private void processGeneratedExpressionColumn(Reference reference, Input<?> expressionInput) { toInject.put(reference, expressionInput); final ColumnIdent ident = reference.column(); if (!ident.isTopLevel()) { List<Reference> references = nestedReferenceByTopLevelColumnName.get(ident.name()); if (references == null) { references = new ArrayList<>(); } references.add(reference); nestedReferenceByTopLevelColumnName.put(ident.name(), references); } }
Source:
public void draw (Batch batch, float parentAlpha) { currentBackground.draw(batch, getX(), getY(), getWidth(), getHeight()); layout = new GlyphLayout(style.font, model.getValue().toString()); style.font.draw(batch, model.getValue().toString() + "", getX() + style.background.getLeftWidth(), getY() + (getHeight() + layout.height) / 2); }

Target:
public void draw (Batch batch, float parentAlpha) { currentBackground.draw(batch, getX(), getY(), getWidth(), getHeight()); style.font.draw(batch, model.getDisplayValue() + "", getX() + style.background.getLeftWidth(), getY() + (getHeight() + layout.height) / 2); }
Source:
public boolean isAutomaticProvisioningEnabled () { return AutomaticProvisioningStatus.ENABLED.equals(getAutomaticProvisioning()) ? true : false; }

Target:
public boolean isAutomaticProvisioningEnabled () { return AutomaticProvisioningStatus.ENABLED.equals(getAutomaticProvisioning()); }
Source:
private static void setupLogging() { Logging logging = Logging.initialize(); logging.setLevel("org.apache.parquet.hadoop", WARN); logging.setLevel("parquet.hadoop", WARN); logging.setLevel("org.glassfish.jersey.internal.inject.Providers", ERROR); logging.setLevel("com.facebook.presto.server.PluginManager", WARN); logging.setLevel("io.airlift.bootstrap.LifeCycleManager", WARN); logging.setLevel("com.facebook.presto.security.AccessControlManager", WARN); logging.setLevel("org.eclipse.jetty.server.handler.ContextHandler", WARN); logging.setLevel("org.eclipse.jetty.server.AbstractConnector", WARN); }

Target:
private static void setupLogging() { Logging logging = Logging.initialize(); logging.setLevel("com.facebook.presto.security.AccessControlManager", WARN); logging.setLevel("com.facebook.presto.server.PluginManager", WARN); logging.setLevel("io.airlift.bootstrap.LifeCycleManager", WARN); logging.setLevel("org.apache.parquet.hadoop", WARN); logging.setLevel("org.eclipse.jetty.server.handler.ContextHandler", WARN); logging.setLevel("org.eclipse.jetty.server.AbstractConnector", WARN); logging.setLevel("org.glassfish.jersey.internal.inject.Providers", ERROR); logging.setLevel("parquet.hadoop", WARN); }
Source:
public Integer getNumExecutors() { return numExecutors; }

Target:
public int getNumExecutors() { return numExecutors; }
Source:
public static TableRow row(String table) throws SQLException { return new TableRow(canonicalize(table), getColumnNames(null, table)); }

Target:
public static TableRow row(String table) throws SQLException { return new TableRow(canonicalize(table), getColumnNames(table)); }
Source:
public void onLASTeamChange(OnChangedComponent event, EntityRef characterEntity, LASTeamComponent lasTeamComponent) { if (characterEntity.hasComponent(VisualCharacterComponent.class)) { VisualCharacterComponent visualCharacterComponent = characterEntity.getComponent(VisualCharacterComponent.class); EntityRef visualCharacter = visualCharacterComponent.visualCharacter; if (visualCharacter != EntityRef.NULL && visualCharacter.hasComponent(SkeletalMeshComponent.class)) { SkeletalMeshComponent skeletalMeshComponent = visualCharacter.getComponent(SkeletalMeshComponent.class); if (lasTeamComponent.team.equals(LASUtils.BLACK_TEAM)) { skeletalMeshComponent.material = Assets.getMaterial(LASUtils.BLACK_PAWN_SKIN).get(); } else if (lasTeamComponent.team.equals(LASUtils.RED_TEAM)) { skeletalMeshComponent.material = Assets.getMaterial(LASUtils.RED_PAWN_SKIN).get(); } visualCharacter.saveComponent(skeletalMeshComponent); } } }

Target:
public void onLASTeamChange(OnChangedComponent event, EntityRef characterEntity, LASTeamComponent lasTeamComponent) { if (characterEntity.hasComponent(VisualCharacterComponent.class)) { VisualCharacterComponent visualCharacterComponent = characterEntity.getComponent(VisualCharacterComponent.class); EntityRef visualCharacter = visualCharacterComponent.visualCharacter; if (visualCharacter != EntityRef.NULL && visualCharacter.hasComponent(SkeletalMeshComponent.class)) { SkeletalMeshComponent skeletalMeshComponent = visualCharacter.getComponent(SkeletalMeshComponent.class); skeletalMeshComponent.material = Assets.getMaterial(LASUtils.getPlayerSkin(lasTeamComponent.team)).get(); visualCharacter.saveComponent(skeletalMeshComponent); } } }
Source:
public int readInteger() { final byte[] intbuff = new byte[4]; try { mCompressedStream.read(intbuff, 0, 4); } catch (IOException ioe) { throw(new RuntimeIOException("Read error in CSI compressed stream: " + ioe)); } return((intbuff[0] & 0xFF) | ((intbuff[1] & 0xFF) << 8) | ((intbuff[2] & 0xFF) << 16) | ((intbuff[3] & 0xFF) << 24)); }

Target:
public int readInteger() { return binaryCodec.readInt(); }
Source:
protected List<PermissionNode> createPermissions() { List<PermissionNode> permissions = new ArrayList<>(); PermissionLeafNode node1 = createPermissionLeafNode(RepositoryFeatures.CONFIGURE_REPOSITORY, i18n.ConfigureRepositories(), i18n.ConfigureRepositoriesHelp()); PermissionLeafNode node2 = createPermissionLeafNode(EDIT_SOURCES, i18n.DataModelerEditSources(), i18n.DataModelerEditSourcesHelp()); PermissionLeafNode node3 = createPermissionLeafNode(PLANNER_AVAILABLE, i18n.ResourcePlanner(), i18n.ResourcePlannerHelp()); PermissionLeafNode node4 = createPermissionLeafNode(JAR_DOWNLOAD, i18n.MavenRepositoryPagedJarTableDownloadJar(), i18n.MavenRepositoryPagedJarTableDownloadJarHelp()); PermissionLeafNode node5 = createPermissionLeafNode(EDIT_GLOBAL_PREFERENCES, i18n.EditGlobalPreferences(), i18n.EditGlobalPreferencesHelp()); PermissionLeafNode node6 = createPermissionLeafNode(EDIT_GUIDED_DECISION_TABLE, i18n.EditGuidedDecisionTable(), i18n.EditGuidedDecisionTableHelp()); permissions.add(node1); permissions.add(node2); permissions.add(node3); permissions.add(node4); permissions.add(node5); permissions.add(node6); return permissions; }

Target:
protected List<PermissionNode> createPermissions() { List<PermissionNode> permissions = new ArrayList<>(); PermissionLeafNode node1 = createPermissionLeafNode(RepositoryFeatures.CONFIGURE_REPOSITORY, i18n.ConfigureRepositories(), i18n.ConfigureRepositoriesHelp()); PermissionLeafNode node2 = createPermissionLeafNode(EDIT_SOURCES, i18n.DataModelerEditSources(), i18n.DataModelerEditSourcesHelp()); PermissionLeafNode node3 = createPermissionLeafNode(PLANNER_AVAILABLE, i18n.ResourcePlanner(), i18n.ResourcePlannerHelp()); PermissionLeafNode node4 = createPermissionLeafNode(JAR_DOWNLOAD, i18n.MavenRepositoryPagedJarTableDownloadJar(), i18n.MavenRepositoryPagedJarTableDownloadJarHelp()); PermissionLeafNode node5 = createPermissionLeafNode(EDIT_GLOBAL_PREFERENCES, i18n.EditGlobalPreferences(), i18n.EditGlobalPreferencesHelp()); PermissionLeafNode node6 = createPermissionLeafNode(GUIDED_DECISION_TABLE_EDIT_COLUMNS, i18n.GuidedDecisionTableEditColumns(), i18n.GuidedDecisionTableEditColumnsHelp()); permissions.add(node1); permissions.add(node2); permissions.add(node3); permissions.add(node4); permissions.add(node5); permissions.add(node6); return permissions; }
Source:
public void onClickedAd(String zoneId) { if(_isVideo()) { this.mediationRewardedVideoAdListener.onAdClicked(rewardedAdapter); this.mediationRewardedVideoAdListener.onAdLeftApplication(rewardedAdapter); } else if (_isInterstitial()) { this.mediationInterstitialListener.onAdClicked(interstitialAdapter); } }

Target:
public void onClickedAd(String zoneId) { if(_isVideo()) { this.mediationRewardedVideoAdListener.onAdClicked(rewardedAdapter); this.mediationRewardedVideoAdListener.onAdLeftApplication(rewardedAdapter); } else if (_isInterstitial()) { this.mediationInterstitialListener.onAdClicked(interstitialAdapter); this.mediationInterstitialListener.onAdLeftApplication(interstitialAdapter); } }
Source:
private void importCertificate() { Frontend.getInstance().runAction(VdcActionType.ImportProviderCertificate, importCertificatesParams(), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { testProviderConnectivity(); } }, null, false); sourceListModel.setConfirmWindow(null); }

Target:
private void importCertificate() { Frontend.getInstance().runAction(VdcActionType.ImportProviderCertificate, importCertificateParams(), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { testProviderConnectivity(); } }, null, false); sourceListModel.setConfirmWindow(null); }
Source:
private long verifyIndexTable(String tableName, String indexName, Connection conn) throws Exception { IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); long actualRowCount = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); PTable pIndexTable = PhoenixRuntime.getTable(conn, indexName); TableName physicalTableName = org.apache.hadoop.hbase.TableName.valueOf(pIndexTable.getPhysicalName().getBytes()); PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); try (Admin admin = pConn.getQueryServices().getAdmin()) { admin.disableTable(physicalTableName); admin.truncateTable(physicalTableName, true); } IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); long actualRowCountAfterCompaction = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); assertEquals(actualRowCount, actualRowCountAfterCompaction); return actualRowCount; }

Target:
private long verifyIndexTable(String tableName, String indexName, Connection conn) throws Exception { IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); long actualRowCount = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.ONLY); IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); PTable pIndexTable = PhoenixRuntime.getTable(conn, indexName); TableName physicalTableName = TableName.valueOf(pIndexTable.getPhysicalName().getBytes()); PhoenixConnection pConn = conn.unwrap(PhoenixConnection.class); try (Admin admin = pConn.getQueryServices().getAdmin()) { admin.disableTable(physicalTableName); admin.truncateTable(physicalTableName, true); } IndexToolIT.runIndexTool(true, false, "", tableName, indexName, null, 0, IndexTool.IndexVerifyType.AFTER); long actualRowCountAfterCompaction = IndexScrutiny.scrutinizeIndex(conn, tableName, indexName); assertEquals(actualRowCount, actualRowCountAfterCompaction); return actualRowCount; }
Source:
TypeArgumentConstraintLocation(ConstraintLocation delegate, TypeVariable<?> typeParameter, Type typeOfAnnotatedElement) { this.delegate = delegate; this.typeParameter = typeParameter; this.typeForValidatorResolution = ReflectionHelper.boxedType( typeOfAnnotatedElement ); this.containerType = delegate.getTypeForValidatorResolution(); ConstraintLocation outterDelegate = delegate; while ( outterDelegate instanceof TypeArgumentConstraintLocation ) { outterDelegate = ( (TypeArgumentConstraintLocation) outterDelegate ).delegate; } this.outterDelegate = outterDelegate; }

Target:
TypeArgumentConstraintLocation(ConstraintLocation delegate, TypeVariable<?> typeParameter, Type typeOfAnnotatedElement) { this.delegate = delegate; this.typeParameter = typeParameter; this.typeForValidatorResolution = ReflectionHelper.boxedType( typeOfAnnotatedElement ); this.containerType = delegate.getTypeForValidatorResolution(); ConstraintLocation outerDelegate = delegate; while ( outerDelegate instanceof TypeArgumentConstraintLocation ) { outerDelegate = ( (TypeArgumentConstraintLocation) outerDelegate ).delegate; } this.outerDelegate = outerDelegate; }
Source:
void performCustomMigrationForMultiple() { ProjectId id1 = createId(1); ProjectId id2 = createId(2); ProjectId id3 = createId(3); TestProjectionRepository repository = repository(); TestProjection projection1 = new TestProjection(id1); TestProjection projection2 = new TestProjection(id2); TestProjection projection3 = new TestProjection(id3); repository.store(projection1); repository.store(projection2); repository.store(projection3); TargetFilters filters = targetFilters(Project.Column.name(), SetTestProjectionName.NEW_NAME); Iterator<TestProjection> found = repository.find(filters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(ImmutableSet.of(id1, id2), new SetTestProjectionName()); Iterator<TestProjection> foundAfterMigration = repository.find(filters, ResponseFormat.getDefaultInstance()); ImmutableList<TestProjection> results = ImmutableList.copyOf(foundAfterMigration); assertThat(results).hasSize(2); assertThat(results) .comparingElementsUsing(idCorrespondence()) .containsExactly(id1, id2); }

Target:
void performCustomMigrationForMultiple() { ProjectId id1 = createId(1); ProjectId id2 = createId(2); ProjectId id3 = createId(3); TestProjectionRepository repository = repository(); TestProjection projection1 = new TestProjection(id1); TestProjection projection2 = new TestProjection(id2); TestProjection projection3 = new TestProjection(id3); repository.store(projection1); repository.store(projection2); repository.store(projection3); TargetFilters filters = targetFilters(Project.Column.name(), SetTestProjectionName.NEW_NAME); Iterator<TestProjection> found = repository.find(filters, ResponseFormat.getDefaultInstance()); assertThat(found.hasNext()).isFalse(); repository.applyMigration(ImmutableSet.of(id1, id2), new SetTestProjectionName()); Iterator<TestProjection> foundAfterMigration = repository.find(filters, ResponseFormat.getDefaultInstance()); ImmutableList<TestProjection> results = ImmutableList.copyOf(foundAfterMigration); Project expectedState1 = projection1 .state() .toBuilder() .setName(SetTestProjectionName.NEW_NAME) .setIdString(projection1.getIdString()) .build(); Project expectedState2 = projection2 .state() .toBuilder() .setName(SetTestProjectionName.NEW_NAME) .setIdString(projection2.getIdString()) .build(); assertThat(results).hasSize(2); assertThat(results) .comparingElementsUsing(entityState()) .containsExactly(expectedState1, expectedState2); }
Source:
private void checkCondition(ExpressionTree tree) { SymbolicValue result = evaluator.evaluate(new ExecutionState(), tree); if (result.equals(SymbolicValue.BOOLEAN_FALSE)) { context.addIssue(tree, this, "Change this condition so that it does not always evaluate to \"false\""); } else if (result.equals(SymbolicValue.BOOLEAN_TRUE)) { context.addIssue(tree, this, "Change this condition so that it does not always evaluate to \"true\""); } }

Target:
private void checkCondition(ExpressionTree tree) { SymbolicBooleanConstraint result = evaluator.evaluate(new ExecutionState(), tree); if (result == SymbolicBooleanConstraint.FALSE) { raiseIssue(tree, "false"); } else if (result == SymbolicBooleanConstraint.TRUE) { raiseIssue(tree, "true"); } }
Source:
public double getMeanJobSubmittingPeriod() { return executeReadOnlyTransaction(session -> { Query query = session.getNamedQuery("getMeanJobSubmittingPeriod"); Object[] result = (Object[]) query.uniqueResult(); Long count = (Long) result[0]; Long minSubmittedTime = (Long) result[1]; Long maxSubmittedTime = (Long) result[2]; if (count < 2) { return 0d; } else { return (maxSubmittedTime - minSubmittedTime) / (double) (count - 1); } }); }

Target:
public double getMeanJobSubmittingPeriod() { return executeReadOnlyTransaction(session -> { Query query = session.getNamedQuery("getMeanJobSubmittingPeriod"); Object[] result = (Object[]) query.uniqueResult(); Long count = (Long) result[0]; Long minSubmittedTime = (Long) result[1]; Long maxSubmittedTime = (Long) result[2]; if (count < 2) { return 0.0d; } else { return (maxSubmittedTime - minSubmittedTime) / (double) (count - 1); } }); }
Source:
protected boolean isClaimExists(Connection dbConnection, String uri) throws UserStoreException { int claimId = getClaimId(dbConnection, uri); if (claimId != -1) { return true; } else { return false; } }

Target:
protected boolean isClaimExists(Connection dbConnection, String uri) throws UserStoreException { int claimId = getClaimId(dbConnection, uri); return claimId != -1; }
Source:
public Void visit(Attribute entry, Void _) { if (Constants.GENERATED_LOCATION.equals(entry.getLocation())) return null; if (context.isParsingTag(entry.getKey())) return null; if (entry.getKey().equals(Attribute.keyOf("latex"))) return null; if (entry.getKey().equals(Attribute.keyOf("html"))) { return null; } if (firstAttribute) { result.append(" [ <span class =\"attribute\"> "); firstAttribute = false; } else { result.append(", "); } result.append(makeGreek(Attribute.toString(entry.getKey()))); String value = makeGreek(entry.getValue().toString()); if (!value.isEmpty()) result.append("(" + value + ")"); return null; }

Target:
public Void visit(Attribute entry, Void _) { if (Constants.GENERATED_LOCATION.equals(entry.getLocation())) return null; if (context.isParsingTag(entry.getKey())) return null; if (entry.getKey().equals(Attribute.keyOf("latex")) || entry.getKey().equals(Attribute.keyOf("html"))) { return null; } if (firstAttribute) { result.append(" [ <span class =\"attribute\"> "); firstAttribute = false; } else { result.append(", "); } result.append(makeGreek(entry.getKey().toString())); String value = makeGreek(entry.getValue().toString()); if (!value.isEmpty()) result.append("(" + value + ")"); return null; }
Source:
public Page getNextPage() { try { batchId++; int batchSize = recordReader.nextBatch(); if (batchSize <= 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { Type type = types.get(fieldId); if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, batchSize); } else { blocks[fieldId] = new LazyBlock(batchSize, new OrcBlockLoader(hiveColumnIndexes[fieldId], type)); } } return new Page(batchSize, blocks); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (IOException | RuntimeException e) { closeWithSuppression(e); if (e instanceof OrcCorruptionException) { throw new PrestoException(HIVE_BAD_DATA, e); } throw new PrestoException(HIVE_CURSOR_ERROR, e); } }

Target:
public Page getNextPage() { try { batchId++; int batchSize = recordReader.nextBatch(); if (batchSize <= 0) { close(); return null; } Block[] blocks = new Block[hiveColumnIndexes.length]; for (int fieldId = 0; fieldId < blocks.length; fieldId++) { Type type = types.get(fieldId); if (constantBlocks[fieldId] != null) { blocks[fieldId] = constantBlocks[fieldId].getRegion(0, batchSize); } else { blocks[fieldId] = new LazyBlock(batchSize, new OrcBlockLoader(hiveColumnIndexes[fieldId], type)); } } return new Page(batchSize, blocks); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (OrcCorruptionException e) { closeWithSuppression(e); throw new PrestoException(HIVE_BAD_DATA, e); } catch (IOException | RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); } }
Source:
public ScenarioForceTemplate(int forceAlignment, int generationMethod, double forceMultiplier, List<Integer> deploymentZones, int destinationZone, int retreatThreshold, int allowedUnitType) { this.forceAlignment = forceAlignment; this.generationMethod = generationMethod; this.forceMultiplier = forceMultiplier; this.deploymentZones = new ArrayList<>(); this.destinationZone = destinationZone; this.retreatThreshold = retreatThreshold; this.allowedUnitType = allowedUnitType; deploymentZones = new ArrayList<>(); Collections.copy(this.deploymentZones, deploymentZones); }

Target:
public ScenarioForceTemplate(int forceAlignment, int generationMethod, double forceMultiplier, List<Integer> deploymentZones, int destinationZone, int retreatThreshold, int allowedUnitType) { this.forceAlignment = forceAlignment; this.generationMethod = generationMethod; this.forceMultiplier = forceMultiplier; this.deploymentZones = new ArrayList<>(); this.destinationZone = destinationZone; this.retreatThreshold = retreatThreshold; this.allowedUnitType = allowedUnitType; this.deploymentZones = deploymentZones == null ? new ArrayList<>() : new ArrayList<>(deploymentZones); }
Source:
public void registerCatalogFunction( UnresolvedIdentifier unresolvedIdentifier, Class<? extends UserDefinedFunction> functionClass, boolean ignoreIfExists) { try { UserDefinedFunctionHelper.validateClass(functionClass); } catch (Throwable t) { throw new ValidationException( String.format( "Could not register catalog function '%s' due to implementation errors.", catalogManager.qualifyIdentifier(unresolvedIdentifier).asSummaryString()), t); } final CatalogFunction catalogFunction = new CatalogFunctionImpl( functionClass.getName(), FunctionLanguage.JAVA); registerCatalogFunction(unresolvedIdentifier, catalogFunction, ignoreIfExists); }

Target:
public void registerCatalogFunction( UnresolvedIdentifier unresolvedIdentifier, Class<? extends UserDefinedFunction> functionClass, boolean ignoreIfExists) { final ObjectIdentifier identifier = catalogManager.qualifyIdentifier(unresolvedIdentifier); final ObjectIdentifier normalizedIdentifier = FunctionIdentifier.normalizeObjectIdentifier(identifier); try { UserDefinedFunctionHelper.validateClass(functionClass); } catch (Throwable t) { throw new ValidationException( String.format( "Could not register catalog function '%s' due to implementation errors.", identifier.asSummaryString()), t); } final Catalog catalog = catalogManager.getCatalog(normalizedIdentifier.getCatalogName()) .orElseThrow(IllegalStateException::new); final ObjectPath path = identifier.toObjectPath(); if (tempCatalogFunctions.containsKey(normalizedIdentifier)) { if (ignoreIfExists) { return; } throw new ValidationException( String.format( "Could not register catalog function. A temporary function '%s' does already exist. " + "Please drop the temporary function first.", identifier.asSummaryString())); } if (catalog.functionExists(path)) { if (ignoreIfExists) { return; } throw new ValidationException( String.format( "Could not register catalog function. A function '%s' does already exist.", identifier.asSummaryString())); } final CatalogFunction catalogFunction = new CatalogFunctionImpl( functionClass.getName(), FunctionLanguage.JAVA); try { catalog.createFunction(path, catalogFunction, ignoreIfExists); } catch (Throwable t) { throw new TableException( String.format( "Could not register catalog function '%s'.", identifier.asSummaryString()), t); } }