auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<ViewCSSProperty> getViewProperties() { if (mViewProperties == null) { synchronized (this) { if (mViewProperties == null) { Set<ViewCSSProperty> props = new TreeSet<>(new Comparator<ViewCSSProperty>() { @Override public int compare(ViewCSSProperty lhs, ViewCSSProperty rhs) { return lhs.getCSSName().compareTo(rhs.getCSSName()); } }); for (final Method method : View.class.getDeclaredMethods()) { ViewDebug.ExportedProperty annotation = method.getAnnotation( ViewDebug.ExportedProperty.class); if (annotation != null) { props.add(new MethodBackedCSSProperty( method, convertViewPropertyNameToCSSName(method.getName()), annotation)); } } for (final Field field : View.class.getDeclaredFields()) { ViewDebug.ExportedProperty annotation = field.getAnnotation( ViewDebug.ExportedProperty.class); if (annotation != null) { props.add(new FieldBackedCSSProperty( field, convertViewPropertyNameToCSSName(field.getName()), annotation)); } } mViewProperties = Collections.unmodifiableList(new ArrayList<>(props)); } } } return mViewProperties; }

Target:
private List<ViewCSSProperty> getViewProperties() { if (mViewProperties == null) { synchronized (this) { if (mViewProperties == null) { List<ViewCSSProperty> props = new ArrayList<>(); for (final Method method : View.class.getDeclaredMethods()) { ViewDebug.ExportedProperty annotation = method.getAnnotation( ViewDebug.ExportedProperty.class); if (annotation != null) { props.add(new MethodBackedCSSProperty( method, convertViewPropertyNameToCSSName(method.getName()), annotation)); } } for (final Field field : View.class.getDeclaredFields()) { ViewDebug.ExportedProperty annotation = field.getAnnotation( ViewDebug.ExportedProperty.class); if (annotation != null) { props.add(new FieldBackedCSSProperty( field, convertViewPropertyNameToCSSName(field.getName()), annotation)); } } Collections.sort(props, new Comparator<ViewCSSProperty>() { @Override public int compare(ViewCSSProperty lhs, ViewCSSProperty rhs) { return lhs.getCSSName().compareTo(rhs.getCSSName()); } }); mViewProperties = Collections.unmodifiableList(props); } } } return mViewProperties; }
Source:
public ScheduledFuture<ExchangeScheduler> deferredTaskManager(ThreadPoolTaskScheduler scheduler) { long intervalMinutes = DEFAULT_EXCHANGE_REFRESH_INTERVAL; try { ExchangeInfoType exInfo = ExchangeInfoDAOFileImpl.getInstance().loadExchangeInfo(); long interval = exInfo.getRefreshInterval(); if (interval <= 0) { intervalMinutes = DEFAULT_EXCHANGE_REFRESH_INTERVAL; } else { intervalMinutes = interval; } } catch (ExchangeManagerException e) { LOG.error("Could not set interval rate. Defaulting to seconds by default. Error is : {}", DEFAULT_EXCHANGE_REFRESH_INTERVAL, e.getMessage()); } PeriodicTrigger periodicTrigger = new PeriodicTrigger(intervalMinutes, TimeUnit.MINUTES); periodicTrigger.setInitialDelay(intervalMinutes); return (ScheduledFuture<ExchangeScheduler>) scheduler.schedule(new ExchangeScheduler(), periodicTrigger); }

Target:
public ScheduledFuture<ExchangeScheduler> deferredTaskManager(ThreadPoolTaskScheduler scheduler) { long intervalMinutes = DEFAULT_EXCHANGE_REFRESH_INTERVAL; try { ExchangeInfoType exInfo = ExchangeInfoDAOFileImpl.getInstance().loadExchangeInfo(); long interval = exInfo.getRefreshInterval(); if (interval <= 0) { intervalMinutes = DEFAULT_EXCHANGE_REFRESH_INTERVAL; } else { intervalMinutes = interval; } } catch (ExchangeManagerException e) { LOG.error("Could not set interval rate. Defaulting to minutes by default. Error is : {}", DEFAULT_EXCHANGE_REFRESH_INTERVAL, e.getMessage()); LOG.error("Exception Occurred:", e); } PeriodicTrigger periodicTrigger = new PeriodicTrigger(intervalMinutes, TimeUnit.MINUTES); periodicTrigger.setInitialDelay(intervalMinutes); return (ScheduledFuture<ExchangeScheduler>) scheduler.schedule(new ExchangeScheduler(), periodicTrigger); }
Source:
public int message(String message, String actionMessage, View.OnClickListener actionOnClick, int priority){ MessageKey key = new MessageKey(++mMessageId, priority); Message value = new Message(key, message, actionMessage, actionOnClick); mMessagesList.put(key, value); updateList(); if (mMessagesList.size() == 0) { hide(); } else { show(); } return mMessageId; }

Target:
public int message(String message, String actionMessage, View.OnClickListener actionOnClick, int priority){ return message(message, actionMessage, actionOnClick, priority, true, 0); }
Source:
public Integer getResolvedCount() { int resolved = 0; Integer[] partials = { getFailedCount(), getInvalidCount(), getDeliveredCount() }; for (Integer partial : partials) { if (partial != null) { resolved += partial; } } return resolved; }

Target:
public int getResolvedCount() { return getFailedCount() + getInvalidCount() + getDeliveredCount(); }
Source:
void loadData(String tblName, String TEST_DATA_FILE, WebTarget parent, GrillSessionHandle grillSessionId) throws InterruptedException { Connection conn = null; PreparedStatement stmt = null; try { conn = driver.getConnection(conf); stmt = conn.prepareStatement("INSERT INTO " + tblName + " VALUES(?, ?)"); for (int i = 0; i < NUM_RECORDS; i++) { stmt.setInt(1, i); stmt.setString(2, "" + i); stmt.executeUpdate(); } conn.commit(); LOG.info("@@ Inserted " + NUM_RECORDS + " in " + tblName); } catch (Exception e) { e.printStackTrace(); } finally { try { if (stmt != null) stmt.close(); if (conn != null) conn.close(); } catch (Exception e) { e.printStackTrace(); } } }

Target:
void loadData(String tblName, String TEST_DATA_FILE, WebTarget parent, GrillSessionHandle grillSessionId) throws InterruptedException { Connection conn = null; PreparedStatement stmt = null; try { conn = driver.getConnection(conf); stmt = conn.prepareStatement("INSERT INTO " + tblName + " VALUES(?, ?)"); for (int i = 0; i < NUM_RECORDS; i++) { stmt.setInt(1, i); if (i % 2 == 0) { stmt.setString(2, "" + i); } else { stmt.setString(2, null); } stmt.executeUpdate(); } conn.commit(); LOG.info("@@ Inserted " + NUM_RECORDS + " in " + tblName); } catch (Exception e) { e.printStackTrace(); } finally { try { if (stmt != null) stmt.close(); if (conn != null) conn.close(); } catch (Exception e) { e.printStackTrace(); } } }
Source:
private String getAnonymousClassTypeName(TypeSymbol symbol) { String name = ""; if (!symbol.getSuperclass().is("java.lang.Object")) { name = symbol.getSuperclass().getSymbol().getName(); } else { name = symbol.getInterfaces().get(0).getSymbol().getName(); } return name; }

Target:
private String getAnonymousClassTypeName(TypeSymbol symbol) { String name = ""; if (symbol.getInterfaces().isEmpty()) { name = getTypeName(symbol.getSuperclass()); } else { name = getTypeName(symbol.getInterfaces().get(0)); } return name; }
Source:
public static void main(String[] args) { WebHDFSCommand cmd = new WebHDFSCommand(new Groovysh()); List<String> args2 = new ArrayList<>(); cmd.execute(args2); }

Target:
public static void main(String[] args) { WebHDFSCommand cmd = new WebHDFSCommand(new Groovysh()); cmd.execute(new ArrayList<>(Arrays.asList(args))); }
Source:
public JSONObject getAdminAnnouncements() { LOG.debug("get admin announcements"); final SqlSession session = factory.openSession(); JSONObject data = new JSONObject(); try { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); data = parser.parseAnnouncementsMap(mapper.getAdminAnnouncements()); session.commit(); } catch (Exception e) { throw new RuntimeException("Failed to get admin announcements", e); } finally { session.close(); } return data; }

Target:
public JSONObject getAdminAnnouncements() { try (final SqlSession session = factory.openSession()) { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); return parser.parseAnnouncementsMap(mapper.getAdminAnnouncements()); } catch (Exception e) { throw new ServiceRuntimeException("Failed to get admin announcements", e); } }
Source:
public Object getObject(int field) { return null; }

Target:
public Object getObject(int field) { return serializeObject(columnHandles.get(field).getColumnType(), null, getFieldValue(field)); }
Source:
public Set<User> showUsers() { return (Set<User>)userService.getAllUsers(); }

Target:
public List<User> showUsers() { return (List<User>)userService.getAllUsers(); }
Source:
public Builder withAADPrefix(byte[] aadPrefixBytes) { if (null == aadPrefixBytes) { return this; } if (null != this.aadPrefixBytes) { throw new IllegalArgumentException("AAD Prefix already set"); } this.aadPrefixBytes = aadPrefixBytes; return this; }

Target:
public Builder withAADPrefix(byte[] aadPrefixBytes) { if (null == aadPrefixBytes) { return this; } if (null != this.aadPrefixBytes) { throw new IllegalStateException("AAD Prefix already set"); } this.aadPrefixBytes = aadPrefixBytes; return this; }
Source:
public void requestBulletCreation(GameObjectDAO data) { ByteBuffer buffer = ByteBuffer.allocate(256); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.put((byte)1); buffer.put((byte)Opcodes.REQUEST_BULLET.getValue()); buffer.put((byte)2); buffer.putDouble(data.x); buffer.putDouble(data.y); buffer.putDouble(data.height); buffer.putDouble(data.velocityX); buffer.putDouble(data.velocityY); buffer.putInt(data.bulletType.ordinal()); buffer.putDouble(data.damage); buffer.putInt(data.ownerId); buffer.put((byte)4); sendTcp(buffer.array()); }

Target:
public void requestBulletCreation(GameObjectDAO data) { ByteBuffer buffer = ByteBuffer.allocate(256); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.put((byte)1); buffer.put((byte)Opcodes.REQUEST_BULLET.getValue()); buffer.put((byte)2); buffer.putDouble(data.x); buffer.putDouble(data.y); buffer.putDouble(data.height); buffer.putDouble(data.velocityX); buffer.putDouble(data.velocityY); buffer.putInt(data.bulletType.ordinal()); buffer.putDouble(data.damage); buffer.putInt(data.ownerId); buffer.putInt(data.entityType.ordinal()); buffer.put((byte)4); sendTcp(buffer.array()); }
Source:
protected void init() { getRegexTextField().setText(""); getEnabledCheckBox().setSelected(true); getDescTextField().setText(""); token = null; KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); AbstractAction escapeAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { dispatchEvent(new WindowEvent(DialogAddToken.this, WindowEvent.WINDOW_CLOSING)); } }; getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); getRootPane().getActionMap().put("ESCAPE", escapeAction); }

Target:
protected void init() { getRegexTextField().setText(""); getEnabledCheckBox().setSelected(true); getDescTextField().setText(""); token = null; }
Source:
public void run() { printStats(this.replicationManager.getStats()); printStats(this.replicationSink.getStats()); globalMetricsSource.setWALReaderEditsBufferBytes(replicationManager.getTotalBufferUsed().get()); }

Target:
public void run() { printStats(this.replicationManager.getStats()); printStats(this.replicationSink.getStats()); }
Source:
public void setUp() { Sprite sprite = new SingleSprite("TestSprite"); physicsLook = new PhysicsLook(sprite, new PhysicsWorld(1920, 1600)); look = new Look(sprite); method.setAccessible(true); }

Target:
public void setUp() { Sprite sprite = mock(Sprite.class); PhysicsWorld physicsWorld = new PhysicsWorld(1920, 1600); physicsLook = new PhysicsLook(sprite, physicsWorld); look = new Look(sprite); method.setAccessible(true); }
Source:
private static void responseError(HttpServletRequest request, HttpServletResponse response, String errmsg) throws IOException { if (errmsg == null || errmsg.length() == 0) errmsg = "Invalid Request (see: Server logs for details)"; response.sendError(400, errmsg); }

Target:
private static void responseError(HttpServletRequest request, HttpServletResponse response, String errmsg) throws IOException { response.sendError(HttpServletResponse.SC_BAD_REQUEST, errmsg); }
Source:
public static void loadLibrary(String name) { String libname = System.mapLibraryName(name); if (tryLoadLibraryFromBuildDir(libname)) { return; } String os = System.getProperty("os.name"); if (os.equals("Linux")) { if (tryLoadLibraryFromFHS(libname)) { return; } } System.loadLibrary(name); }

Target:
public static void loadLibrary(String name) { loadLibraryCalled = true; String libname = System.mapLibraryName(name); if (tryLoadFromXtreemfsLibPath(libname)) { return; } if (tryLoadLibraryFromBuildDir(libname)) { return; } String os = System.getProperty("os.name"); if (os.equals("Linux")) { if (tryLoadLibraryFromFHS(libname)) { return; } } System.loadLibrary(name); }
Source:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters().getCommandStep(), getParameters().getChildCommands()); Guid currentChildId = getCurrentChildId(getParameters().getCommandStep(), getParameters().getChildCommands()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }

Target:
public boolean performNextOperation(int completedChildCount) { log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }
Source:
public void profileChangePassword(WebContext ctx) { UserAccount userAccount = oma.refreshOrFail(getUser().getUserObject(UserAccount.class)); assertNotNew(userAccount); if (ctx.isSafePOST()) { try { String oldPassword = ctx.get(PARAM_OLD_PASSWORD).asString(); String newPassword = ctx.get(PARAM_NEW_PASSWORD).asString(); String confirmation = ctx.get(PARAM_CONFIRMATION).asString(); validateOldPassword(oldPassword, userAccount); userAccount.getLogin().verifyPassword(newPassword, confirmation, userAccount.getMinPasswordLength()); userAccount.getLogin().setCleartextPassword(newPassword); oma.update(userAccount); auditLog.neutral("%s changed her or his password.", UserContext.getCurrentUser().getUserName()) .forCurrentUser() .log(); showSavedMessage(); } catch (Exception e) { auditLog.neutral("Ann error occurred when %s tried to changed her or his password: %s", UserContext.getCurrentUser().getUserName(), e.getMessage()).forCurrentUser().log(); UserContext.handle(e); } } ctx.respondWith().template("/templates/tenants/profile-change-password.html.pasta", userAccount); }

Target:
public void profileChangePassword(WebContext ctx) { UserAccount userAccount = oma.refreshOrFail(getUser().getUserObject(UserAccount.class)); assertNotNew(userAccount); if (ctx.ensureSafePOST()) { try { String oldPassword = ctx.get(PARAM_OLD_PASSWORD).asString(); String newPassword = ctx.get(PARAM_NEW_PASSWORD).asString(); String confirmation = ctx.get(PARAM_CONFIRMATION).asString(); validateOldPassword(oldPassword, userAccount); userAccount.getLogin().verifyPassword(newPassword, confirmation, userAccount.getMinPasswordLength()); userAccount.getLogin().setCleartextPassword(newPassword); oma.update(userAccount); auditLog.neutral("%s changed the password.", UserContext.getCurrentUser().getUserName()) .forCurrentUser() .log(); showSavedMessage(); } catch (Exception e) { auditLog.neutral("An error occurred when %s tried to changed the password: %s", UserContext.getCurrentUser().getUserName(), e.getMessage()).forCurrentUser().log(); UserContext.handle(e); } } ctx.respondWith().template("/templates/tenants/profile-change-password.html.pasta", userAccount); }
Source:
protected void onBindView(@NonNull View view) { super.onBindView(view); TextView titleView = (TextView) view.findViewById(android.R.id.title); if (titleView != null) { Resources res = getContext().getResources(); titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.text_sz_large)); titleView.setTextColor(res.getColor(isEnabled() ? R.color.grey_dark : R.color.grey_lighten_10)); if (!TextUtils.isEmpty(getDependency())) { titleView.setPadding(getContext().getResources().getDimensionPixelSize(R.dimen.margin_large), 0, 0, 0); } } }

Target:
protected void onBindView(@NonNull View view) { super.onBindView(view); TextView titleView = (TextView) view.findViewById(android.R.id.title); if (titleView != null) { Resources res = getContext().getResources(); titleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, res.getDimensionPixelSize(R.dimen.text_sz_large)); titleView.setTextColor(res.getColor(isEnabled() ? R.color.grey_dark : R.color.grey_lighten_10)); if (!TextUtils.isEmpty(getDependency())) { titleView.setPadding(res.getDimensionPixelSize(R.dimen.margin_large), 0, 0, 0); } } }
Source:
public static Span startInboundSpan( Request request, Tracer tracer, TracingContext tracingContext) { SpanContext parentContext = null; if (request instanceof TraceableRequest) { TraceableRequest traceableRequest = (TraceableRequest) request; Map<String, String> headers = traceableRequest.getHeaders(); PrefixedHeadersCarrier carrier = new PrefixedHeadersCarrier(headers); try { parentContext = tracer.extract(Format.Builtin.TEXT_MAP, carrier); Map<String, String> nonTracingHeaders = carrier.getNonTracingHeaders(); if (nonTracingHeaders.size() < headers.size()) { traceableRequest.updateHeaders(nonTracingHeaders); } } catch (Exception e) { logger.error("Failed to extract span context from headers", e); } } else { } Tracer.SpanBuilder builder = tracer.buildSpan(request.getEndpoint()); builder .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER) .withTag("as", request.getArgScheme().name()); Map<String, String> transportHeaders = request.getTransportHeaders(); if (transportHeaders != null && transportHeaders.containsKey("cn")) { builder.withTag(Tags.PEER_SERVICE.getKey(), transportHeaders.get("cn")); } if (parentContext != null) { builder.asChildOf(parentContext); } Span span = builder.start(); tracingContext.clear(); tracingContext.pushSpan(span); return span; }

Target:
public static Span startInboundSpan( Request request, Tracer tracer, TracingContext tracingContext ) { SpanContext parentContext = null; if (request instanceof TraceableRequest) { TraceableRequest traceableRequest = (TraceableRequest) request; Map<String, String> headers = traceableRequest.getHeaders(); PrefixedHeadersCarrier carrier = new PrefixedHeadersCarrier(headers); try { parentContext = tracer.extract(Format.Builtin.TEXT_MAP, carrier); Map<String, String> nonTracingHeaders = carrier.getNonTracingHeaders(); if (nonTracingHeaders.size() < headers.size()) { traceableRequest.setHeaders(nonTracingHeaders); } } catch (Exception e) { logger.error("Failed to extract span context from headers", e); } } else { } Tracer.SpanBuilder builder = tracer.buildSpan(request.getEndpoint()); builder .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER) .withTag("as", request.getArgScheme().name()); Map<String, String> transportHeaders = request.getTransportHeaders(); if (transportHeaders != null && transportHeaders.containsKey("cn")) { builder.withTag(Tags.PEER_SERVICE.getKey(), transportHeaders.get("cn")); } if (parentContext != null) { builder.asChildOf(parentContext); } Span span = builder.start(); tracingContext.clear(); tracingContext.pushSpan(span); return span; }
Source:
public GenericRow next(GenericRow reuse) throws IOException { Message message = null; try { DynamicMessage tmp = DynamicMessage.getDefaultInstance(_descriptor); Message.Builder builder = tmp.newBuilderForType(); builder.mergeDelimitedFrom(_inputStream); message = builder.build(); } catch (Exception e) { throw new IOException("Caught exception while reading protobuf object", e); } _recordExtractor.extract(message, reuse); _hasNext = hasMoreToRead(); return reuse; }

Target:
public GenericRow next(GenericRow reuse) throws IOException { Message message = null; try { Message.Builder builder = _dynamicMessage.newBuilderForType(); builder.mergeDelimitedFrom(_inputStream); message = builder.build(); } catch (Exception e) { throw new IOException("Caught exception while reading protobuf object", e); } _recordExtractor.extract(message, reuse); _hasNext = hasMoreToRead(); return reuse; }
Source:
public void run() { PlanDefinition<JobConfig, Serializable, Serializable> definition; try { definition = PlanDefinitionRegistry.INSTANCE.getJobDefinition(mJobConfig); } catch (JobDoesNotExistException e) { LOG.error("The job definition for config does not exist.", mJobConfig.getName()); return; } Serializable result; try { result = definition.runTask(mJobConfig, mTaskArgs, mContext); } catch (Throwable t) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", mJobConfig.getName(), mTaskArgs.toString(), t.getMessage()); return; } mTaskExecutorManager.notifyTaskCompletion(mJobId, mTaskId, result); }

Target:
public void run() { PlanDefinition<JobConfig, Serializable, Serializable> definition; try { definition = PlanDefinitionRegistry.INSTANCE.getJobDefinition(mJobConfig); } catch (JobDoesNotExistException e) { LOG.error("The job definition for config does not exist.", mJobConfig.getName()); return; } Serializable result; try { result = definition.runTask(mJobConfig, mTaskArgs, mContext); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } catch (Throwable t) { if (ServerConfiguration.getBoolean(PropertyKey.DEBUG)) { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, ExceptionUtils.getStackTrace(t)); } else { mTaskExecutorManager.notifyTaskFailure(mJobId, mTaskId, t.getMessage()); } LOG.warn("Exception running task for job {}({}) : {}", mJobConfig.getName(), mTaskArgs.toString(), t.getMessage()); return; } mTaskExecutorManager.notifyTaskCompletion(mJobId, mTaskId, result); }
Source:
public byte[] instrument(final byte[] buffer, final String name) throws IOException { try { if (Java9Support.isPatchRequired(buffer)) { final byte[] result = instrument( new ClassReader(Java9Support.downgrade(buffer))); Java9Support.upgrade(result); return result; } else { return instrument(new ClassReader(buffer)); } } catch (final RuntimeException e) { throw instrumentError("class " + name, e); } }

Target:
public byte[] instrument(final byte[] buffer, final String name) throws IOException { try { if (Java9Support.isPatchRequired(buffer)) { final byte[] result = instrument( new ClassReader(Java9Support.downgrade(buffer))); Java9Support.upgrade(result); return result; } else { return instrument(new ClassReader(buffer)); } } catch (final RuntimeException e) { throw instrumentError(name, e); } }
Source:
public NettyHttpService(InetSocketAddress bindAddress, int bossThreadPoolSize, int workerThreadPoolSize, int execThreadPoolSize, long execThreadKeepAliveSecs, Map<String, Object> channelConfigs, RejectedExecutionHandler rejectedExecutionHandler, URLRewriter urlRewriter, Iterable<? extends HttpHandler> httpHandlers, Iterable<? extends HandlerHook> handlerHooks, int httpChunkLimit) { this.bindAddress = bindAddress; this.bossThreadPoolSize = bossThreadPoolSize; this.workerThreadPoolSize = workerThreadPoolSize; this.execThreadPoolSize = execThreadPoolSize; this.execThreadKeepAliveSecs = execThreadKeepAliveSecs; this.channelConfigs = ImmutableMap.copyOf(channelConfigs); this.rejectedExecutionHandler = rejectedExecutionHandler; this.channelGroup = new DefaultChannelGroup(); this.resourceHandler = new HttpResourceHandler(httpHandlers, handlerHooks, urlRewriter, new DefaultExceptionHandler()); this.handlerContext = new BasicHandlerContext(this.resourceHandler); this.httpChunkLimit = httpChunkLimit; this.pipelineModifier = null; this.sslHandlerFactory = null; this.exceptionHandler = new DefaultExceptionHandler(); }

Target:
public NettyHttpService(InetSocketAddress bindAddress, int bossThreadPoolSize, int workerThreadPoolSize, int execThreadPoolSize, long execThreadKeepAliveSecs, Map<String, Object> channelConfigs, RejectedExecutionHandler rejectedExecutionHandler, URLRewriter urlRewriter, Iterable<? extends HttpHandler> httpHandlers, Iterable<? extends HandlerHook> handlerHooks, int httpChunkLimit) { this(bindAddress, bossThreadPoolSize, workerThreadPoolSize, execThreadPoolSize, execThreadKeepAliveSecs, channelConfigs, rejectedExecutionHandler, urlRewriter, httpHandlers, handlerHooks, httpChunkLimit, null, null, new ExceptionHandler()); }
Source:
private static Object[][] propertiesMapProvider() { DataMap properties1 = new DataMap(); properties1.put("empty", new DataMap()); DataMap properties2 = new DataMap(); properties2.put("validate", properties1); DataMap properties3 = new DataMap(); DataMap nestedMap = new DataMap(properties2); nestedMap.putAll(properties1); properties3.put("nested", nestedMap); return new Object[][]{{properties1, "@empty = {}\n"}, {properties2, "@validate.empty = {}\n"} }; }

Target:
private static Object[][] propertiesMapProvider() { DataMap properties1 = new DataMap(); properties1.put("empty", new DataMap()); DataMap properties2 = new DataMap(); properties2.put("validate", properties1); return new Object[][] { { properties1, "@empty = {}\n" }, { properties2, "@validate.empty = {}\n" } }; }
Source:
public String toString() { StringBuilder builder = new StringBuilder(25); builder.append("Is refresh? "); builder.append(refresh); builder.append(", Is filtered? "); builder.append(isFiltered); return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(25); builder.append("refresh: "); builder.append(refresh); builder.append(", filtered: "); builder.append(isFiltered); return builder.toString(); }
Source:
public String getThreadName(ITmfEvent event) { ITmfEventField content = event.getContent(); String procName = (String) content.getField(fLayout.contextProcname()).getValue(); int vtid = getThreadId(event); if (procName == null) { throw new IllegalStateException(); } return procName + '-' + Integer.toString(vtid); }

Target:
public String getThreadName(ITmfEvent event) { ITmfEventField content = event.getContent(); String procName = (String) content.getField(fLayout.contextProcname()).getValue(); int vtid = getThreadId(event); return (procName + '-' + Integer.toString(vtid)); }
Source:
public Optional<ConnectorNewTableLayout> getPreferredShuffleLayoutForInsert(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()) .orElseThrow(() -> new TableNotFoundException(tableName)); Optional<HiveBucketHandle> hiveBucketHandle = getHiveBucketHandle(table); if (hiveBucketHandle.isPresent()) { return Optional.empty(); } if (!(isShufflePartitionedColumnsForTableWriteEnabled(session) || table.getPartitionColumns().isEmpty())) { return Optional.empty(); } HivePartitioningHandle partitioningHandle = new HivePartitioningHandle( SHUFFLE_MAX_PARALLELISM_FOR_PARTITIONED_TABLE_WRITE, table.getPartitionColumns().stream() .map(Column::getType) .collect(Collectors.toList()), OptionalInt.empty()); List<String> partitionedBy = table.getPartitionColumns().stream() .map(Column::getName) .collect(Collectors.toList()); return Optional.of(new ConnectorNewTableLayout(partitioningHandle, partitionedBy)); }

Target:
public Optional<ConnectorNewTableLayout> getPreferredShuffleLayoutForInsert(ConnectorSession session, ConnectorTableHandle tableHandle) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = metastore.getTable(tableName.getSchemaName(), tableName.getTableName()) .orElseThrow(() -> new TableNotFoundException(tableName)); Optional<HiveBucketHandle> hiveBucketHandle = getHiveBucketHandle(table); if (hiveBucketHandle.isPresent()) { return Optional.empty(); } if (!isShufflePartitionedColumnsForTableWriteEnabled(session) || table.getPartitionColumns().isEmpty()) { return Optional.empty(); } HivePartitioningHandle partitioningHandle = new HivePartitioningHandle( SHUFFLE_MAX_PARALLELISM_FOR_PARTITIONED_TABLE_WRITE, table.getPartitionColumns().stream() .map(Column::getType) .collect(Collectors.toList()), OptionalInt.empty()); List<String> partitionedBy = table.getPartitionColumns().stream() .map(Column::getName) .collect(Collectors.toList()); return Optional.of(new ConnectorNewTableLayout(partitioningHandle, partitionedBy)); }
Source:
public Aggregator[][] getDimExtractionRowSelector(TopNQuery query, TopNParams params, Capabilities capabilities) { if (params.getCardinality() < 0) { return null; } final BaseTopNAlgorithm.AggregatorArrayProvider provider = new BaseTopNAlgorithm.AggregatorArrayProvider( (DimensionSelector) params.getSelectorPlus().getSelector(), query, params.getCardinality(), capabilities ); return provider.build(); }

Target:
public Aggregator[][] getDimExtractionRowSelector(TopNQuery query, TopNParams params, Capabilities capabilities) { if (params.getCardinality() < 0) { throw new UnsupportedOperationException("Cannot operate on a dimension with unknown cardinality"); } final BaseTopNAlgorithm.AggregatorArrayProvider provider = new BaseTopNAlgorithm.AggregatorArrayProvider( (DimensionSelector) params.getSelectorPlus().getSelector(), query, params.getCardinality(), capabilities ); return provider.build(); }
Source:
public void login(LoginListener listener) { encodeAuthorizationToken(listener.getUsername(), listener.getPassword()); String url = listener.getServerURL() + LOGIN_END_URL; mLogger.i(SENDING_REQUEST + url); Response.ErrorListener errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { error.printStackTrace(); } }; JsonObjectRequestWrapper jsObjRequest = new JsonObjectRequestWrapper(Request.Method.GET, url, null, listener, errorListener, DO_GZIP_REQUEST) { @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> params = new HashMap<String, String>(); params.put(ApplicationConstants.AUTHORIZATION_PARAM, mOpenMRS.getAuthorizationToken()); return params; } }; mOpenMRS.addToRequestQueue(jsObjRequest); }

Target:
public void login(LoginListener listener) { encodeAuthorizationToken(listener.getUsername(), listener.getPassword()); String url = listener.getServerURL() + LOGIN_END_URL; mLogger.i(SENDING_REQUEST + url); Response.ErrorListener errorListener = new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mLogger.e(error.toString()); } }; JsonObjectRequestWrapper jsObjRequest = new JsonObjectRequestWrapper(Request.Method.GET, url, null, listener, errorListener, DO_GZIP_REQUEST) { @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> params = new HashMap<String, String>(); params.put(ApplicationConstants.AUTHORIZATION_PARAM, mOpenMRS.getAuthorizationToken()); return params; } }; mOpenMRS.addToRequestQueue(jsObjRequest); }
Source:
public void goToTwitter (View view) { String url = "<LINK_0>"; link(url); }

Target:
public void goToTwitter (View view) { link("<LINK_0>"); }
Source:
private RestEndpointGroup getHttpApiEndpointGroup(String operation, String requestUri) { if (requestUri.startsWith(HttpCommandProcessor.URI_MAPS) || requestUri.startsWith(HttpCommandProcessor.URI_QUEUES)) { return RestEndpointGroup.DATA; } if (requestUri.startsWith(HttpCommandProcessor.URI_HEALTH_URL)) { return RestEndpointGroup.HEALTH_CHECK; } if (requestUri.startsWith(HttpCommandProcessor.URI_WAN_BASE_URL + "/wan/") || requestUri.startsWith("/hazelcast/rest/wan/")) { return RestEndpointGroup.WAN; } if (requestUri.startsWith(HttpCommandProcessor.URI_FORCESTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_PARTIALSTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_INTERRUPT_CLUSTER_URL)) { return RestEndpointGroup.HOT_RESTART; } if (requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_STATE_URL) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_NODES_URL) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_LICENSE_INFO)) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_VERSION_URL)) || requestUri.startsWith(HttpCommandProcessor.URI_INSTANCE)) { return RestEndpointGroup.CLUSTER_READ; } if (requestUri.startsWith("/hazelcast/")) { return RestEndpointGroup.CLUSTER_WRITE; } return null; }

Target:
private RestEndpointGroup getHttpApiEndpointGroup(String operation, String requestUri) { if (requestUri.startsWith(HttpCommandProcessor.URI_MAPS) || requestUri.startsWith(HttpCommandProcessor.URI_QUEUES)) { return RestEndpointGroup.DATA; } if (requestUri.startsWith(HttpCommandProcessor.URI_HEALTH_URL)) { return RestEndpointGroup.HEALTH_CHECK; } if (requestUri.startsWith(HttpCommandProcessor.URI_WAN_BASE_URL)) { return RestEndpointGroup.WAN; } if (requestUri.startsWith(HttpCommandProcessor.URI_FORCESTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_PARTIALSTART_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_CLUSTER_URL) || requestUri.startsWith(HttpCommandProcessor.URI_HOT_RESTART_BACKUP_INTERRUPT_CLUSTER_URL)) { return RestEndpointGroup.HOT_RESTART; } if (requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_STATE_URL) || requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_NODES_URL) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_LICENSE_INFO)) || ("GET".equals(operation) && requestUri.startsWith(HttpCommandProcessor.URI_CLUSTER_VERSION_URL)) || requestUri.startsWith(HttpCommandProcessor.URI_INSTANCE)) { return RestEndpointGroup.CLUSTER_READ; } if (requestUri.startsWith("/hazelcast/")) { return RestEndpointGroup.CLUSTER_WRITE; } return null; }
Source:
protected ScenarioGridColumn insertNewColumn(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, int columnPosition, boolean cloneInstance) { final ScenarioHeaderMetaData selectedInformationHeaderMetaData = selectedColumn.getInformationHeaderMetaData(); final FactMappingValueType factMappingValueType = FactMappingValueType.NOT_EXPRESSION; String columnGroup = selectedInformationHeaderMetaData.getColumnGroup(); String originalInstanceTitle = selectedInformationHeaderMetaData.getTitle(); final FactMappingType factMappingType = FactMappingType.valueOf(columnGroup.toUpperCase()); final Map.Entry<String, String> validPlaceholders = context.getSelectedScenarioGridModel().getValidPlaceholders(); String instanceTitle = cloneInstance ? originalInstanceTitle : validPlaceholders.getKey(); String propertyTitle = validPlaceholders.getValue(); String placeHolder = ScenarioSimulationEditorConstants.INSTANCE.defineValidType(); final ScenarioGridColumn scenarioGridColumnLocal = getScenarioGridColumnLocal(instanceTitle, propertyTitle, String.valueOf(new Date().getTime()), columnGroup, factMappingType, context.getScenarioHeaderTextBoxSingletonDOMElementFactory(), context.getScenarioCellTextAreaSingletonDOMElementFactory(), placeHolder); if (cloneInstance) { scenarioGridColumnLocal.setFactIdentifier(selectedColumn.getFactIdentifier()); } scenarioGridColumnLocal.setInstanceAssigned(cloneInstance); scenarioGridColumnLocal.setPropertyAssigned(false); context.getSelectedScenarioGridModel().insertColumn(columnPosition, scenarioGridColumnLocal); return scenarioGridColumnLocal; }

Target:
protected ScenarioGridColumn insertNewColumn(ScenarioSimulationContext context, ScenarioGridColumn selectedColumn, int columnPosition, boolean cloneInstance) { final ScenarioHeaderMetaData selectedInformationHeaderMetaData = selectedColumn.getInformationHeaderMetaData(); String columnGroup = selectedInformationHeaderMetaData.getColumnGroup(); String originalInstanceTitle = selectedInformationHeaderMetaData.getTitle(); final FactMappingType factMappingType = FactMappingType.valueOf(columnGroup.toUpperCase()); final Map.Entry<String, String> validPlaceholders = context.getSelectedScenarioGridModel().getValidPlaceholders(); String instanceTitle = cloneInstance ? originalInstanceTitle : validPlaceholders.getKey(); String propertyTitle = validPlaceholders.getValue(); String placeHolder = ScenarioSimulationEditorConstants.INSTANCE.defineValidType(); final ScenarioGridColumn scenarioGridColumnLocal = getScenarioGridColumnLocal(instanceTitle, propertyTitle, String.valueOf(new Date().getTime()), columnGroup, factMappingType, context.getScenarioHeaderTextBoxSingletonDOMElementFactory(), context.getScenarioCellTextAreaSingletonDOMElementFactory(), placeHolder); if (cloneInstance) { scenarioGridColumnLocal.setFactIdentifier(selectedColumn.getFactIdentifier()); } scenarioGridColumnLocal.setInstanceAssigned(cloneInstance); scenarioGridColumnLocal.setPropertyAssigned(false); context.getSelectedScenarioGridModel().insertColumn(columnPosition, scenarioGridColumnLocal); return scenarioGridColumnLocal; }
Source:
public void setInsidePolicyAmount(int amount) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof ConditionalGeoFencePolicy)) { throw new Throwable("Source Policy is not ConditionalGeoFence type cannot hold inside policies"); } if (((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInPolicy() == null) { throw new Throwable("Source Policy has no inside policy"); } if (!(((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInPolicy() instanceof MethodAmountPolicy)) { throw new Throwable("Source Policy inside policy is not MethodAmountPolicy"); } ConditionalGeoFencePolicy castedCachedPolicy = (ConditionalGeoFencePolicy) sourceImmutablePolicy; MethodAmountPolicy existingInsidePolicy = (MethodAmountPolicy) castedCachedPolicy.getInPolicy(); MethodAmountPolicy newInsidePolicy = new MethodAmountPolicy(existingInsidePolicy.getDenyRootedJailbroken(), existingInsidePolicy.getDenyEmulatorSimulator(), existingInsidePolicy.getFences(), amount); sourceImmutablePolicy = new ConditionalGeoFencePolicy(castedCachedPolicy.getDenyRootedJailbroken(), castedCachedPolicy.getDenyEmulatorSimulator(), castedCachedPolicy.getFences(), newInsidePolicy, castedCachedPolicy.getOutPolicy()); }

Target:
public void setInsidePolicyAmount(int amount) throws Throwable { if ((sourceImmutablePolicy == null) || !(sourceImmutablePolicy instanceof ConditionalGeoFencePolicy)) { throw new Throwable("Source Policy is not ConditionalGeoFence type cannot hold inside policies"); } if (((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInside() == null) { throw new Throwable("Source Policy has no inside policy"); } if (!(((ConditionalGeoFencePolicy) sourceImmutablePolicy).getInside() instanceof MethodAmountPolicy)) { throw new Throwable("Source Policy inside policy is not MethodAmountPolicy"); } ConditionalGeoFencePolicy castedCachedPolicy = (ConditionalGeoFencePolicy) sourceImmutablePolicy; MethodAmountPolicy existingInsidePolicy = (MethodAmountPolicy) castedCachedPolicy.getInside(); MethodAmountPolicy newInsidePolicy = new MethodAmountPolicy(existingInsidePolicy.getDenyRootedJailbroken(), existingInsidePolicy.getDenyEmulatorSimulator(), existingInsidePolicy.getFences(), amount); sourceImmutablePolicy = new ConditionalGeoFencePolicy(castedCachedPolicy.getDenyRootedJailbroken(), castedCachedPolicy.getDenyEmulatorSimulator(), castedCachedPolicy.getFences(), newInsidePolicy, castedCachedPolicy.getOutside()); }
Source:
public void go(final LinkedBlockingQueue<BytesMessageWithOffset> messageQueue) { thread = new Thread() { @Override public void run() { long offset = startOffset; log.info("Start running parition[%s], offset[%s]", partitionId, offset); try { while (!stopped.get()) { try { Iterable<BytesMessageWithOffset> msgs = consumer.fetch(offset, 10000); int count = 0; for (BytesMessageWithOffset msgWithOffset : msgs) { offset = msgWithOffset.offset(); messageQueue.put(msgWithOffset); count++; } log.debug("fetch [%s] msgs for partition [%s] in one time ", count, partitionId); } catch (InterruptedException e) { log.info("Interrupted when fetching data, shutting down."); return; } catch (Exception e) { log.error(e, "Exception happened in fetching data, but will continue consuming"); } } } finally { consumer.stop(); } } }; thread.setDaemon(true); thread.setName(String.format("kafka-%s-%s", topic, partitionId)); thread.start(); }

Target:
public void go(final LinkedBlockingQueue<BytesMessageWithOffset> messageQueue) { thread = new Thread() { @Override public void run() { long offset = startOffset; log.info("Start running parition[%s], offset[%s]", partitionId, offset); try { while (!stopped.get()) { try { Iterable<BytesMessageWithOffset> msgs = consumer.fetch(offset, CONSUMER_FETCH_TIMEOUT); int count = 0; for (BytesMessageWithOffset msgWithOffset : msgs) { offset = msgWithOffset.offset(); messageQueue.put(msgWithOffset); count++; } log.debug("fetch [%s] msgs for partition [%s] in one time ", count, partitionId); } catch (InterruptedException e) { log.info("Interrupted when fetching data, shutting down."); return; } catch (Exception e) { log.error(e, "Exception happened in fetching data, but will continue consuming"); } } } finally { consumer.stop(); } } }; thread.setDaemon(true); thread.setName(String.format("kafka-%s-%s", topic, partitionId)); thread.start(); }