auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected int run(List<String> nonFlagArgs) throws Exception { final KijiTable table = getKiji().openTable(getURI().getTable()); try { final KijiTableWriter writer = table.openTableWriter(); try { for (KijiColumnName column : getURI().getColumns()) { try { final CellSchema cellSchema = table.getLayout().getCellSchema(column); if (cellSchema.getType() != SchemaType.COUNTER) { LOG.error("Can't increment non counter-type column: " + column); return 1; } final EntityId entityId = ToolUtils.createEntityIdFromUserInputs(mEntityId, table.getLayout()); writer.increment(entityId, column.getFamily(), column.getQualifier(), mValue); } catch (IOException ioe) { LOG.error("Error while incrementing column: " + column); return 1; } } } finally { writer.close(); } } finally { table.close(); } <START> return 0; END> }</code><technical_language>SUCCESS</technical_language>

Target:
protected int run(List<String> nonFlagArgs) throws Exception { final Kiji kiji = Kiji.Factory.open(mCellURI); try { final KijiTable table = kiji.openTable(mCellURI.getTable()); try { final KijiTableWriter writer = table.openTableWriter(); try { for (KijiColumnName column : mCellURI.getColumns()) { try { final CellSchema cellSchema = table.getLayout().getCellSchema(column); if (cellSchema.getType() != SchemaType.COUNTER) { LOG.error("Can't increment non counter-type column '{}'", column); return FAILURE; } final EntityId entityId = ToolUtils.createEntityIdFromUserInputs(mEntityId, table.getLayout()); writer.increment(entityId, column.getFamily(), column.getQualifier(), mValue); } catch (IOException ioe) { LOG.error("Error while incrementing column '{}'", column); return FAILURE; } } return SUCCESS; } finally { writer.close(); } } finally { table.close(); } } finally { kiji.release(); } }
Source:
<code>public Geometry extractGroupByResult(GroupByResultHolder groupByResultHolder, int groupKey) { <START> return groupByResultHolder.getResult(groupKey); <END> }</code><technical_language>Need handle null (return empty Geometry)</technical_language>

Target:
public Geometry extractGroupByResult(GroupByResultHolder groupByResultHolder, int groupKey) { Geometry geometry = groupByResultHolder.getResult(groupKey); return geometry == null ? GeometryUtils.EMPTY_POINT : geometry; }
Source:
<code>public static NetworkClass getNetworkClass(Context context) { ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); <START> NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); <END> if (mWifi.isConnected()) { return NetworkClass.TYPE_WIFI; } TelephonyManager mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); int networkType = mTelephonyManager.getNetworkType(); switch (networkType) { case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN: return NetworkClass.TYPE_2G; case TelephonyManager.NETWORK_TYPE_UMTS: case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_EHRPD: return NetworkClass.TYPE_3G; case TelephonyManager.NETWORK_TYPE_HSPAP: case TelephonyManager.NETWORK_TYPE_LTE: return NetworkClass.TYPE_4G; default: return NetworkClass.Unknown; } }</code><technical_language>This var named wifi, right? instance var</technical_language>

Target:
public static NetworkClass getNetworkClass(Context context) { ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connManager != null) { NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (wifi != null && wifi.isConnected()) { return NetworkClass.TYPE_WIFI; } } TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { int networkType = telephonyManager.getNetworkType(); switch (networkType) { case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_IDEN: case TelephonyManager.NETWORK_TYPE_UMTS: return NetworkClass.TYPE_2G; case TelephonyManager.NETWORK_TYPE_EVDO_0: case TelephonyManager.NETWORK_TYPE_EVDO_A: case TelephonyManager.NETWORK_TYPE_HSDPA: case TelephonyManager.NETWORK_TYPE_HSUPA: case TelephonyManager.NETWORK_TYPE_HSPA: case TelephonyManager.NETWORK_TYPE_EVDO_B: case TelephonyManager.NETWORK_TYPE_EHRPD: return NetworkClass.TYPE_3G; case TelephonyManager.NETWORK_TYPE_HSPAP: case TelephonyManager.NETWORK_TYPE_LTE: return NetworkClass.TYPE_4G; default: return NetworkClass.Unknown; } } return NetworkClass.Unknown; }
Source:
<code>public MethodBinding[] checkAndAddSyntheticRecordMethods(MethodBinding[] methodBindings, int count) { if (!this.isRecordDeclaration) return methodBindings; List<MethodBinding> <START> tmp = <END> checkAndAddSyntheticRecordComponentAccessors(methodBindings); tmp = checkAndAddSyntheticRecordOverrideMethods(methodBindings, tmp); for (int i = 0; i < count; ++i) tmp.add(methodBindings[i]); return tmp.toArray(new MethodBinding[0]); }</code><technical_language>variable name ;p</technical_language>

Target:
public MethodBinding[] checkAndAddSyntheticRecordMethods(MethodBinding[] methodBindings, int count) { if (!this.isRecordDeclaration) return methodBindings; List<MethodBinding> implicitMethods = checkAndAddSyntheticRecordComponentAccessors(methodBindings); implicitMethods = checkAndAddSyntheticRecordOverrideMethods(methodBindings, implicitMethods); for (int i = 0; i < count; ++i) implicitMethods.add(methodBindings[i]); return implicitMethods.toArray(new MethodBinding[0]); }
Source:
<code><START> private Integer parseIdFromViewName(String viewName) { <END> if (viewName.matches("flow_" + "^-?\\d+") || viewName.matches("catch_" + "^-?\\d+")) { String[] strings = viewName.split("_"); String id = strings[1]; if (isInteger(id)) { return new Integer(id); } else { log.info("The portion of the view name that represents the model output id was not an Integer and won't be included in the set: " + id); } } else { log.info("View name did not match catch_ or flow_ prefix and is not included in the set.: " + viewName); } return 0; }</code><technical_language>please write a test for this method? a fan of testing parsers a habit subtle pitfalls easier test require expensive/complicated mocks</technical_language>

Target:
private Integer parseIdFromViewName(String viewName) { if (viewName.matches("^(flow_|catch_)[-]?[0-9]{9}$")) { String[] strings = viewName.split("_"); String id = strings[1]; if (isInteger(id)) { log.info("The model output id: " + id + " has a view representation already:" + viewName + " No additional views will be created for it."); return new Integer(id); } else { log.info("The portion of the view name that represents the model output id was not an Integer and won't be included in the set to create views : " + id); } } else { log.info("View name did not match catch_ or flow_ prefix and is not included in the set.: " + viewName); } return 0; }
Source:
<code>public int hashCode() { <START> return value != null ? value.hashCode() : 0; <END> }</code><technical_language>generate hashcode again, doesnt account for caseSensitive</technical_language>

Target:
public int hashCode() { return Objects.hashCode(value) + (caseSensitive ? (byte) 1 : 0); }
Source:
<code>public static void main(String[] args) throws Exception { Gauge gauge = Gauge.build().name("labels").help("foo").labelNames("bar").register(); for (int i = 0; i < 10000; i++) { gauge.labels(UUID.randomUUID().toString()).set(Math.random()); } ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics"); <START> Server server = new Server(1234); <END> server.setHandler(context); server.start(); Thread.sleep(1000); byte[] bytes = new byte[8192]; URL url = new URL("http://localhost:1234/metrics"); long start = System.nanoTime(); for (int i = 0; i < 100; i++) { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream in = connection.getInputStream(); try { while (in.read(bytes) != -1) in.available(); } finally { in.close(); } connection.disconnect(); } System.out.println(String.format("%,3d ns", System.nanoTime() - start)); server.stop(); server.join(); }</code><technical_language>Do need run a HTTP server test this</technical_language>

Target:
public static void main(String[] args) throws Exception { Gauge gauge = Gauge.build().name("labels").help("foo").labelNames("bar").register(); for (int i = 0; i < 10000; i++) { gauge.labels(UUID.randomUUID().toString()).set(Math.random()); } ServletContextHandler context = new ServletContextHandler(); context.setContextPath("/"); context.addServlet(new ServletHolder(new MetricsServlet()), "/metrics"); Server server = new Server(0); server.setHandler(context); server.start(); Thread.sleep(1000); byte[] bytes = new byte[8192]; URL url = new URL("http", "localhost", server.getConnectors()[0].getLocalPort(), "/metrics"); long start = System.nanoTime(); for (int i = 0; i < 100; i++) { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream in = connection.getInputStream(); try { while (in.read(bytes) != -1) in.available(); } finally { in.close(); } connection.disconnect(); } System.out.println(String.format("%,3d ns", System.nanoTime() - start)); server.stop(); server.join(); }
Source:
<code>private int getMethodPriority(IMethodInstance mi) { int result = 0; Method method = mi.getMethod().getMethod(); Priority a1 = method.getAnnotation(Priority.class); if (a1 != null) { result = a1.value(); } <START> return result; <END> }</code><technical_language>variable result unnecessary here</technical_language>

Target:
private int getMethodPriority(IMethodInstance mi) { Method method = getMethod(mi); Priority a1 = method.getAnnotation(Priority.class); if (a1 != null) { return a1.value(); } return 0; }
Source:
<code>protected void registerLaunch() { ILaunchConfigurationWorkingCopy lc; try { lc = getCLaunchConfigType().newInstance(null, "TestLaunch"); } catch(CoreException e) { <START> throw assertFail(); <END> } ISourceLocator sourceLocator = null; DsfLaunch dsfLaunch = new DsfLaunch(lc, "debug", sourceLocator); session.registerModelAdapter(ILaunch.class, dsfLaunch); }</code><technical_language>seens actual intention is simply fail test case throwing exception call Junit fail() method return;</technical_language>

Target:
protected void registerLaunch() { ILaunchConfigurationWorkingCopy lc; try { lc = getCLaunchConfigType().newInstance(null, "TestLaunch"); } catch(CoreException e) { fail(e.getMessage()); return; } ISourceLocator sourceLocator = null; DsfLaunch dsfLaunch = new DsfLaunch(lc, ILaunchManager.DEBUG_MODE, sourceLocator); fSession.registerModelAdapter(ILaunch.class, dsfLaunch); }
Source:
<code>public void setProcessVariables(BaseProcessVariables processVariables) { String value = processVariables.getValue(); DeclarationList declarationList = DeclarationList.fromString(value); List<Property> properties = process.getProperties(); declarationList.getDeclarations().forEach(decl -> { VariableScope.Variable variable = variableScope.declare(this.process.getId(), decl.getIdentifier(), decl.getType(), decl.getKpi()); <START> if (Boolean.parseBoolean(decl.getKpi())) { <END> CustomElement.customKPI.of(variable.getTypedIdentifier()).set(Boolean.parseBoolean(decl.getKpi())); } properties.add(variable.getTypedIdentifier()); this.itemDefinitions.add(variable.getTypeDeclaration()); }); }</code><technical_language>this conditional expression redudant - parses decl.getKpi() setting parsed</technical_language>

Target:
public void setProcessVariables(BaseProcessVariables processVariables) { String value = processVariables.getValue(); DeclarationList declarationList = DeclarationList.fromString(value); List<Property> properties = process.getProperties(); declarationList.getDeclarations().forEach(decl -> { VariableScope.Variable variable = variableScope.declare(this.process.getId(), decl.getIdentifier(), decl.getType(), decl.getKpi()); if (Boolean.parseBoolean(decl.getKpi())) { CustomElement.customKPI.of(variable.getTypedIdentifier()).set(true); } properties.add(variable.getTypedIdentifier()); this.itemDefinitions.add(variable.getTypeDeclaration()); }); }
Source:
<code>public <T, SpecT> SpecT createSpec(CatalogItem<T, SpecT> item) { CatalogItemDo<T,SpecT> loadedItem = (CatalogItemDo<T, SpecT>) getCatalogItemDo(item.getId()); Class<SpecT> specType = loadedItem.getSpecType(); if (specType==null) return null; String yaml = loadedItem.getPlanYaml(); SpecT spec = null; if (yaml!=null) { DeploymentPlan plan = makePlanFromYaml(yaml); switch (item.getCatalogItemType()) { case ENTITY:return createEntitySpec(loadedItem, plan); case POLICY:return createPolicySpec(loadedItem, plan); <START> default: throw new RuntimeException("Only entity & policy catalog items are supported."); <END> } } try { if (loadedItem.getJavaType()!=null) { SpecT specT = (SpecT) Reflections.findMethod(specType, "create", Class.class).invoke(null, loadedItem.loadJavaClass(mgmt)); spec = specT; } } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Unsupported creation of spec type "+specType+"; it must have a public static create(Class) method", e); } if (spec==null) throw new IllegalStateException("Unknown how to create instance of "+this); return spec; }</code><technical_language>good in exception message type passed in</technical_language>

Target:
public <T, SpecT> SpecT createSpec(CatalogItem<T, SpecT> item) { CatalogItemDo<T,SpecT> loadedItem = (CatalogItemDo<T, SpecT>) getCatalogItemDo(item.getId()); Class<SpecT> specType = loadedItem.getSpecType(); if (specType==null) return null; String yaml = loadedItem.getPlanYaml(); SpecT spec = null; if (yaml!=null) { DeploymentPlan plan = makePlanFromYaml(yaml); switch (item.getCatalogItemType()) { case ENTITY:return createEntitySpec(loadedItem, plan); case POLICY:return createPolicySpec(loadedItem, plan); default: throw new RuntimeException("Only entity & policy catalog items are supported. Unsupported catalog item type " + item.getCatalogItemType()); } } try { if (loadedItem.getJavaType()!=null) { SpecT specT = (SpecT) Reflections.findMethod(specType, "create", Class.class).invoke(null, loadedItem.loadJavaClass(mgmt)); spec = specT; } } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new IllegalStateException("Unsupported creation of spec type "+specType+"; it must have a public static create(Class) method", e); } if (spec==null) throw new IllegalStateException("Unknown how to create instance of "+this); return spec; }
Source:
<code>RefreshingOAuth2CredentialsInterceptor(ExecutorService scheduler, OAuth2Credentials credentials, RetryOptions retryOptions, Logger logger) { this.executor = Preconditions.checkNotNull(scheduler); this.credentials = Preconditions.checkNotNull(credentials); this.retryOptions = Preconditions.checkNotNull(retryOptions); this.logger = Preconditions.checkNotNull(logger); <START> this.isAppEngine = System.getProperty("com.google.appengine.runtime.environment") != null; <END> }</code><technical_language>this a static field</technical_language>

Target:
RefreshingOAuth2CredentialsInterceptor(ExecutorService scheduler, OAuth2Credentials credentials, RetryOptions retryOptions, Logger logger) { this.executor = Preconditions.checkNotNull(scheduler); this.credentials = Preconditions.checkNotNull(credentials); this.retryOptions = Preconditions.checkNotNull(retryOptions); this.logger = Preconditions.checkNotNull(logger); }
Source:
<code>default List<BibEntry> performComplexSearch(ComplexSearchQuery complexSearchQuery) throws FetcherException { try (InputStream stream = getUrlDownload(getComplexQueryURL(complexSearchQuery)).asInputStream()) { List<BibEntry> fetchedEntries = getParser().parseEntries(stream); fetchedEntries.forEach(this::doPostCleanup); return fetchedEntries; } catch (URISyntaxException e) { throw new FetcherException("Search URI is malformed", e); } catch (IOException e) { try { <START> throw new FetcherException("A network error occurred while fetching from " + getComplexQueryURL(complexSearchQuery), e); <END> } catch (URISyntaxException | MalformedURLException uriSyntaxException) { throw new FetcherException("A network error occurred", e); } } catch (ParseException e) { try { throw new FetcherException("An internal parser error occurred while fetching from " + getComplexQueryURL(complexSearchQuery), e); } catch (URISyntaxException | MalformedURLException uriSyntaxException) { throw new FetcherException("An internal parser error occurred", e); } } }</code><technical_language>Do need show url user? is additional of this? click anyway, error is in url in configuration internet is down</technical_language>

Target:
default List<BibEntry> performComplexSearch(ComplexSearchQuery complexSearchQuery) throws FetcherException { URL urlForQuery; try { urlForQuery = getComplexQueryURL(complexSearchQuery); } catch (URISyntaxException | MalformedURLException | FetcherException e) { throw new FetcherException("Search URI crafted from complex search query is malformed", e); } return getBibEntries(urlForQuery); }
Source:
<code>public static synchronized void shutdownAsynchronousLogging() { if (m_asynchLoggerPool != null) { try { m_asynchLoggerPool.submit(new Runnable() { @Override public void run() }).get(); } catch (Exception e) { Throwables.getRootCause(e).printStackTrace(); } <START> m_asynchLoggerPool.shutdown(); <END> m_asynchLoggerPool = null; } }</code><technical_language>m_asynchLoggerPool null if is disabled</technical_language>

Target:
public static synchronized void shutdownAsynchronousLogging() { if (m_asynchLoggerPool != null) { try { m_asynchLoggerPool.submit(new Runnable() { @Override public void run() }).get(); } catch (Exception e) { Throwables.getRootCause(e).printStackTrace(); } m_asynchLoggerPool.shutdown(); try { m_asynchLoggerPool.awaitTermination(365, TimeUnit.DAYS); } catch (InterruptedException e) { throw new RuntimeException("Unable to shutdown VoltLogger", e); } m_asynchLoggerPool = null; } }
Source:
<code>public static void removeMagicResponseContextFields(Map<String, Object> responseContext) { <START> responseContext.remove(DirectDruidClient.QUERY_FAIL_TIME); <END> responseContext.remove(DirectDruidClient.QUERY_TOTAL_BYTES_GATHERED); }</code><technical_language>This line removed</technical_language>

Target:
public static void removeMagicResponseContextFields(Map<String, Object> responseContext) { responseContext.remove(DirectDruidClient.QUERY_TOTAL_BYTES_GATHERED); }
Source:
<code>public void stop() { setAttribute(Attributes.SERVICE_STATE, Lifecycle.STOPPING); try { Entities.invokeEffectorList(this, ImmutableList.of(getAttribute(CONFIG_SERVER_CLUSTER), getAttribute(ROUTER_CLUSTER), getAttribute(SHARD_CLUSTER)), Startable.STOP).get(); } catch (Exception e) { throw Exceptions.propagate(e); } setAttribute(Attributes.SERVICE_STATE, Lifecycle.STOPPED); <START> setAttribute(SERVICE_UP, false); <END> }</code><technical_language>AbstractApplication.stop() for setting Lifecycle.ON_FIRE etc. for start()</technical_language>

Target:
public void stop() { setAttribute(Attributes.SERVICE_STATE, Lifecycle.STOPPING); try { Entities.invokeEffectorList(this, ImmutableList.of(getAttribute(CONFIG_SERVER_CLUSTER), getAttribute(ROUTER_CLUSTER), getAttribute(SHARD_CLUSTER)), Startable.STOP).get(); } catch (Exception e) { setAttribute(Attributes.SERVICE_STATE, Lifecycle.ON_FIRE); throw Exceptions.propagate(e); } setAttribute(Attributes.SERVICE_STATE, Lifecycle.STOPPED); setAttribute(SERVICE_UP, false); }
Source:
<code>protected String getResults(String sqlQuery) { String json = null; if(sqlQuery == null){ <START> json = "{error:true,msg:'SQL was null'}"; <END> }else{ try { Class.forName("org.apache.phoenix.jdbc.PhoenixDriver"); con = DriverManager.getConnection("jdbc:phoenix:"+PHOENIX_HOST+":"+PHOENIX_PORT); EntityFactory nutrientEntityFactory = new EntityFactory(con,sqlQuery); List<Map<String, Object>> nutrients = nutrientEntityFactory .findMultiple(new Object[] {}); ObjectMapper mapper = new ObjectMapper(); json = mapper.writeValueAsString(nutrients); } catch (Exception e) { json = "{error:true,msg:'Serrver Error:"+e.getMessage()+"'}"; } finally { if (con != null) { try { con.close(); } catch (SQLException e) { json = "{error:true,msg:'SQL Serrver Error:"+e.getMessage()+"'}"; } } } } return json; }</code><technical_language>indentation formatting is off</technical_language>

Target:
protected String getResults(String sqlQuery) { String json = null; if(sqlQuery == null){ json = "{error:true,msg:'SQL was null'}"; }else{ try { con = ConnectionFactory.getConnection(); EntityFactory nutrientEntityFactory = new EntityFactory(con,sqlQuery); List<Map<String, Object>> nutrients = nutrientEntityFactory .findMultiple(new Object[] {}); ObjectMapper mapper = new ObjectMapper(); json = mapper.writeValueAsString(nutrients); } catch (Exception e) { json = "{error:true,msg:'Serrver Error:"+e.getMessage()+"'}"; } finally { if (con != null) { try { con.close(); } catch (SQLException e) { json = "{error:true,msg:'SQL Serrver Error:"+e.getMessage()+"'}"; } } } } return json; }
Source:
<code>private RevCommit parseCommit(RevCommit revCommit) { RevWalk rw = null; <START> try { <END> rw = new RevWalk(repository); return rw.parseCommit(revCommit); } catch (IOException e) { return revCommit; } finally { if (rw != null) { rw.close(); } } }</code><technical_language>Please try-catch resources: try (RevWalk rw = new RevWalk(repository))</technical_language>

Target:
private RevCommit parseCommit(RevCommit revCommit) { try (RevWalk rw = new RevWalk(repository)) { return rw.parseCommit(revCommit); } catch (IOException exception) { LOG.error("Failed to parse commit. ", exception); return revCommit; } }
Source:
<code><START> protected void computeInnerSurviving(int[]surviving, int base, int numSurviving) <END> { innerSurvivingBase = elementOffset[base]; if (numSurviving == 0) { numInnerSurviving = 0; return; } int numInner = 0; for (int i = 0; i < numSurviving; i++) { int position = surviving[i] + base; numInner += elementOffset[position + 1] - elementOffset[position]; } if (innerSurviving == null || innerSurviving.length < numInner) { innerSurviving = new int[numInner]; } numInnerSurviving = numInner; int fill = 0; for (int i = 0; i < numSurviving; i++) { int position = surviving[i] + base; int startIndex = elementOffset[position]; int endIndex = elementOffset[position + 1]; for (int innerPosition = startIndex; innerPosition < endIndex; innerPosition++) { innerSurviving[fill++] = innerPosition - innerSurvivingBase; } } }</code><technical_language>This is method is of this class. private</technical_language>

Target:
private void computeInnerSurviving(int[]surviving, int base, int numSurviving) { innerSurvivingBase = elementOffset[base]; if (numSurviving == 0) { numInnerSurviving = 0; return; } int numInner = 0; for (int i = 0; i < numSurviving; i++) { int position = surviving[i] + base; numInner += elementOffset[position + 1] - elementOffset[position]; } if (innerSurviving.length < numInner) { innerSurviving = newIntArrayForReuse(numInner); } numInnerSurviving = numInner; int fill = 0; for (int i = 0; i < numSurviving; i++) { int position = surviving[i] + base; int startIndex = elementOffset[position]; int endIndex = elementOffset[position + 1]; for (int innerPosition = startIndex; innerPosition < endIndex; innerPosition++) { innerSurviving[fill++] = innerPosition - innerSurvivingBase; } } }
Source:
<code>public Row build(RegularAndStaticColumns columns) { int now = FBUtilities.nowInSeconds(); <START> Row.Builder builder = BTreeRow.unsortedBuilder((int) TimeUnit.MILLISECONDS.toSeconds(now)); <END> builder.newRow(clustering); columns.forEach(c -> { Object value = values.get(c); if (null != value) builder.addCell(BufferCell.live(c, now, decompose(c.type, value))); }); return builder.build(); }</code><technical_language>#unsortedBuilder() longer takes arguments</technical_language>

Target:
public Row build(RegularAndStaticColumns columns) { long now = clock.now(); Row.Builder builder = BTreeRow.unsortedBuilder(); builder.newRow(clustering); columns.forEach(c -> { Object value = values.get(c); if (null != value) builder.addCell(BufferCell.live(c, now, decompose(c.type, value))); }); return builder.build(); }
Source:
<code>private String createPostResponse(String samlResponse, String relayState, String acsUrl) { <START> StringBuilder builder = new StringBuilder("<!DOCTYPE html>"); <END> builder .append("<html>") .append("<head>") .append("<title>Form Submit</title>") .append("</head>") .append("<body Onload=\"document.forms[0].submit()\">") .append("<form id=\"postform\" method=\"POST\" action=\"") .append(acsUrl) .append("\">") .append("<input type=\"hidden\" name=\"SAMLResponse\" value=\"") .append(samlResponse) .append("\"/>"); if (relayState != null) { builder .append("<input type=\"hidden\" name=\"RelayState\" value=\"") .append(relayState) .append("\"/>"); } builder.append("</form></body></html>"); return builder.toString(); }</code><technical_language>Granted this is a trivial response string, a template for insert acsUrl, samlResponse, optional block RelayState</technical_language>

Target:
private String createPostResponse(String samlResponse, String relayState, String acsUrl) { String submitFormUpdated = postResponseForm .replace("{{" + Idp.ACS_URL + "}}", acsUrl) .replace("{{" + Idp.SAML_RESPONSE + "}}", samlResponse); if (relayState != null) { submitFormUpdated = submitFormUpdated.replace( "{{" + Idp.RELAY_STATE + "}}", "<input type=\"hidden\" name=\"RelayState\" value=\"" + relayState + "\"/>"); } else { submitFormUpdated = submitFormUpdated.replace("{{" + Idp.RELAY_STATE + "}}", ""); } return submitFormUpdated; }
Source:
<code>public Sequence<T> run(QueryPlus<T> queryPlus, ResponseContext responseContext) { if (queryPlus.getQuery() != query) { throw new ISE("Unexpected query received"); } Sequence<T> result = baseRunner.run(queryPlus.withQuery(newQuery), responseContext); <START> return result; <END> }</code><technical_language>Unnecessary change</technical_language>

Target:
public Sequence<T> run(QueryPlus<T> queryPlus, ResponseContext responseContext) { if (queryPlus.getQuery() != query) { throw new ISE("Unexpected query received"); } return baseRunner.run(queryPlus.withQuery(newQuery), responseContext); }
Source:
<code>FileReftableStack.CompactionStats getCompactionStats() <START> throws IOException { <END> return reftableStack.getStats(); }</code><technical_language>declared exception thrown</technical_language>

Target:
FileReftableStack.CompactionStats getCompactionStats() { return reftableStack.getStats(); }
Source:
<code>public void testUniqueConstraintAndNOTUniqueIndex() { <START> SessionFactoryConfig config = SessionFactoryConfig.entities( UniqueConstraintAndNotUniqueIndexEntity.class ).build(); <END> insideCatchException( config, e -> { assertThat( e ) .isExactlyInstanceOf( HibernateException.class ) .hasMessage( "OGM001231: Unable to create index indexEmail on collection MyDoc" ); assertThat( e.getCause() ).isExactlyInstanceOf( MongoCommandException.class ); assertThat( e.getCause().getMessage() ).contains( "already exists with different options" ); } ); }</code><technical_language>proposal, call build() method builder</technical_language>

Target:
public void testUniqueConstraintAndNOTUniqueIndex() { config = SessionFactoryBuilder.entities( UniqueConstraintAndNotUniqueIndexEntity.class ); UniqueConstraintAndNotUniqueIndexEntity entity = new UniqueConstraintAndNotUniqueIndexEntity(); entity.name = "Fabio Massimo"; entity.email = "fabiomassimo@myemailprovider.eu"; entity.address = "11bis Rue Roquepine Paris"; this.entity = entity; try ( SessionFactory sessionFactory = config.build() ) { inTransaction( sessionFactory, session -> { session.persist( entity ); } ); inTransaction( sessionFactory, session -> { UniqueConstraintAndNotUniqueIndexEntity stored = session.load( UniqueConstraintAndNotUniqueIndexEntity.class, entity.name ); assertThat( entity.email ).isEqualTo( stored.getEmail() ); assertThat( entity.address ).isEqualTo( stored.getAddress() ); } ); } }
Source:
<code>public PrimitiveProtocol protocol() { PrimitiveProtocol protocol = this.protocol; if (protocol == null) { PrimitiveProtocolConfig protocolConfig = config.getProtocolConfig(); if (protocolConfig == null) { Collection<PartitionGroup> partitionGroups = managementService.getPartitionService().getPartitionGroups(); if (partitionGroups.size() == 1) { protocol = partitionGroups.iterator().next().newProtocol(); } else { <START> throw new ConfigurationException("Primitive protocol is ambiguous: " + partitionGroups.size() + " partition groups found"); <END> } } else { protocol = PrimitiveProtocols.createProtocol(protocolConfig); } } return protocol; }</code><technical_language>print types here</technical_language>

Target:
public PrimitiveProtocol protocol() { PrimitiveProtocol protocol = this.protocol; if (protocol == null) { PrimitiveProtocolConfig protocolConfig = config.getProtocolConfig(); if (protocolConfig == null) { Collection<PartitionGroup> partitionGroups = managementService.getPartitionService().getPartitionGroups(); if (partitionGroups.size() == 1) { protocol = partitionGroups.iterator().next().newProtocol(); } else { String groups = Joiner.on(", ").join(partitionGroups.stream() .map(group -> String.format("%s:%s", group.type().name(), group.name())) .collect(Collectors.toList())); throw new ConfigurationException(String.format("Primitive protocol is ambiguous: %d partition groups found (%s)", partitionGroups.size(), groups)); } } else { protocol = PrimitiveProtocols.createProtocol(protocolConfig); } } return protocol; }
Source:
<code>public void componentOpened() { ApplicationUtils.deleteTempFiles(); CompletionProvider provider = createCompletionProvider(); autoCompletion = new AutoCompletion(provider); autoCompletion.install(rSyntaxTextArea); ApplicationSettings.INSTANCE.registerSettingListeners(this); String initFileDir = (String) ApplicationSettings.Setting.USER_LASTFILE.getValue(); File initFile = new File(initFileDir); if(initFile.exists() && initFile.isFile()) { String content = FileService.readFromFile(initFileDir); setEditorContent(content); setCurrentFile(initFile); } else { InputStream is = null; try { is = getClass().getResource("/openlatexstudio/welcome.tex").openStream(); String welcomeMessage = IOUtils.toString(is); rSyntaxTextArea.setText(welcomeMessage); <START> setDirty(true); <END> } catch (IOException ex) { Exceptions.printStackTrace(ex); } finally { IOUtils.closeQuietly(is); } } }</code><technical_language>"setEditorContent", instead of 2 lines for consistency if</technical_language>

Target:
public void componentOpened() { ApplicationUtils.deleteTempFiles(); CompletionProvider provider = createCompletionProvider(); autoCompletion = new AutoCompletion(provider); autoCompletion.install(rSyntaxTextArea); ApplicationSettings.INSTANCE.registerSettingListeners(this); String initFileDir = (String) ApplicationSettings.Setting.USER_LASTFILE.getValue(); File initFile = new File(initFileDir); if(initFile.exists() && initFile.isFile()) { String content = FileService.readFromFile(initFileDir); setEditorContent(content); setCurrentFile(initFile); } else { InputStream is = null; try { is = getClass().getResource("/openlatexstudio/welcome.tex").openStream(); String welcomeMessage = IOUtils.toString(is); setEditorContent(welcomeMessage); } catch (IOException ex) { Exceptions.printStackTrace(ex); } finally { IOUtils.closeQuietly(is); } } }
Source:
<code>public void completeQuery(UUID queryId, ElideResponse response) { if (!startTime.containsKey(queryId)) { return; } long endTime; long start; endTime = System.currentTimeMillis(); synchronized (this) { start = startTime.get(queryId); startTime.remove(queryId); } long timeElapsed = endTime - start; int responseCode = response.getResponseCode(); <START> log.info("Completed Query with RequestId: " <END> + queryId + ". Query Execution Time: " + timeElapsed + " Response Status: " + responseCode); }</code><technical_language>infos debugs</technical_language>

Target:
public void completeQuery(UUID queryId, ElideResponse response) { long endTime = System.currentTimeMillis(); int responseCode = response.getResponseCode(); log.debug("Completed Query with RequestId: " + queryId + ". End Time: " + endTime + " Response Status: " + responseCode); }
Source:
<code>public void getDataCenterList(AsyncQuery aQuery, boolean doRefresh) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source == null) { return new ArrayList<StoragePool>(); } return source; } }; Frontend.getInstance().runQuery(VdcQueryType.Search, <START> doRefresh ? new SearchParameters("DataCenter: sortby name", SearchType.StoragePool) : END> new SearchParameters("DataCenter: sortby name", SearchType.StoragePool).withoutRefresh(), aQuery); }</code><technical_language>avoid code duplication, suggest follow pattern "getHostListByStatus" method: SearchParameters params = ... Frontend.getInstance().runQuery(VdcQueryType.Search, doRefresh ? params : params.withoutRefresh(), aQuery); Alternative solution (not if better, needs more code): private <T extends VdcQueryParametersBase> T setupParams(T params, boolean doRefresh) { return doRefresh ? params : params.withoutRefresh(); } // getDataCenterList method Frontend.getInstance().runQuery(VdcQueryType.Search, setupParams(new SearchParameters("DataCenter: sortby name", SearchType.StoragePool), doRefresh), aQuery);</technical_language>

Target:
public void getDataCenterList(AsyncQuery aQuery, boolean doRefresh) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source == null) { return new ArrayList<StoragePool>(); } return source; } }; SearchParameters params = new SearchParameters("DataCenter: sortby name", SearchType.StoragePool); Frontend.getInstance().runQuery(VdcQueryType.Search, doRefresh ? params : params.withoutRefresh(), aQuery); }
Source:
<code>public ProbeStatus run() { boolean started; if (started = TransactionHelper.isNoTransaction()) { <START> TransactionHelper.startTransaction(); <END> } try { List<String> repositories = getRepositoryName(); boolean success = !repositories.isEmpty(); for (String repository : repositories) { success = success && CoreInstance.doPrivileged(repository, (CoreSession session) -> { return session.exists(session.getRootDocument().getRef()); }); } if (success) { return ProbeStatus.newSuccess("Repository started"); } return ProbeStatus.newFailure("Repository not started corectly"); } finally { if (started) { TransactionHelper.commitOrRollbackTransaction(); } } }</code><technical_language>TransactionHelper.runInTransaction( ... lambda ...) instead of dealing this hand</technical_language>

Target:
public ProbeStatus run() { ProbeStatus status; status = TransactionHelper.runInTransaction(() -> { List<String> repositories = getRepositoryName(); boolean success = !repositories.isEmpty(); for (String repository : repositories) { success = success && CoreInstance.doPrivileged(repository, (CoreSession session) -> { return session.exists(session.getRootDocument().getRef()); }); } if (success) { return ProbeStatus.newSuccess("Repository started"); } else { return ProbeStatus.newFailure("Repository not started corectly"); } }); return status; }
Source:
<code>public boolean equals(Object obj) { if (obj instanceof SecureStoreData) { SecureStoreData o = (SecureStoreData) obj; return storeName.equals(o.storeName); } <START> return super.equals(obj); <END> }</code><technical_language>I this implementation of equals, implementation parent class (PluginData) is broken. For example, is transitive. 3 instances: ssd1 = SecureStoreData(name="a", version="b", pluginFile="c", className="d", storeName = "e") ssd2 = SecureStoreData(name="a", version="b", pluginFile="c", className="f", storeName = "g") pd = PluginData(name="a", version="b", pluginFile="c") true: ssd1.equals(pd) pd.equals(ssd2) implies true ssd1.equals(ssd2) is false</technical_language>

Target:
public boolean equals(Object obj) { if (obj instanceof SecureStoreData) { SecureStoreData o = (SecureStoreData) obj; return storeName.equals(o.storeName); } return false; }
Source:
<code>protected RequestStatus abortRequestById(RequestExecution requestExecution, Long requestId) throws AmbariException { LOG.debug("Aborting request " + requestId); ResourceProvider provider = <START> ambariContext.getClusterController().ensureResourceProvider(Resource.Type.Request); <END> Map<String, Object> properties = new HashMap<>(); properties.put(RequestResourceProvider.REQUEST_CLUSTER_NAME_PROPERTY_ID, requestExecution.getClusterName()); properties.put(RequestResourceProvider.REQUEST_ABORT_REASON_PROPERTY_ID, "Request execution status changed to " + requestExecution.getStatus()); properties.put(RequestResourceProvider.REQUEST_ID_PROPERTY_ID, Long.toString(requestId)); properties.put(RequestResourceProvider.REQUEST_STATUS_PROPERTY_ID, HostRoleStatus.ABORTED.name()); org.apache.ambari.server.controller.spi.Request request = new RequestImpl(Collections.emptySet(), Collections.singleton(properties), Collections.emptyMap(), null); Predicate predicate = new PredicateBuilder() .property(RequestResourceProvider.REQUEST_CLUSTER_NAME_PROPERTY_ID) .equals(requestExecution.getClusterName()).and() .property(RequestResourceProvider.REQUEST_ID_PROPERTY_ID) .equals(Long.toString(requestId)).toPredicate(); try{ return provider.updateResources(request, predicate); } catch (Exception e) { throw new AmbariException("Error while aborting the request.", e); } }</code><technical_language>AmbariContext is blueprint specific. AbstractControllerResourceProvider.getResourceProvider instead</technical_language>

Target:
protected RequestStatus abortRequestById(RequestExecution requestExecution, Long requestId) throws AmbariException { LOG.debug("Aborting request " + requestId); ResourceProvider provider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.Request); Map<String, Object> properties = new HashMap<>(); properties.put(RequestResourceProvider.REQUEST_CLUSTER_NAME_PROPERTY_ID, requestExecution.getClusterName()); properties.put(RequestResourceProvider.REQUEST_ABORT_REASON_PROPERTY_ID, "Request execution status changed to " + requestExecution.getStatus()); properties.put(RequestResourceProvider.REQUEST_ID_PROPERTY_ID, Long.toString(requestId)); properties.put(RequestResourceProvider.REQUEST_STATUS_PROPERTY_ID, HostRoleStatus.ABORTED.name()); org.apache.ambari.server.controller.spi.Request request = new RequestImpl(Collections.emptySet(), Collections.singleton(properties), Collections.emptyMap(), null); Predicate predicate = new PredicateBuilder() .property(RequestResourceProvider.REQUEST_CLUSTER_NAME_PROPERTY_ID) .equals(requestExecution.getClusterName()).and() .property(RequestResourceProvider.REQUEST_ID_PROPERTY_ID) .equals(Long.toString(requestId)).toPredicate(); try{ return provider.updateResources(request, predicate); } catch (Exception e) { throw new AmbariException("Error while aborting the request.", e); } }
Source:
<code>public SeatmapResponse getAllSeats() { List<Seat> all = seatRespository.findAll(); Map<String, List<Seat>> seatMapResponse = new HashMap<>(); <START> for (Seat seat : all) { <END> if (seatMapResponse.containsKey(seat.getSeatGroup())) { seatMapResponse.get(seat.getSeatGroup()).add(seat); } else { List<Seat> seats = new ArrayList<>(); seats.add(seat); seatMapResponse.put(seat.getSeatGroup(), seats); } } return new SeatmapResponse(seatMapResponse); }</code><technical_language>I a solution streams is easier grasp. lines of java all.stream().map(Seat::getSeatGroup).forEach(g -> seatMapResponse.put(g, new ArrayList<>())); all.stream().forEach(s -> seatMapResponse.get(s.getSeatGroup).add(s);</technical_language>

Target:
public SeatmapResponse getAllSeats() { List<Seat> all = seatRepository.findAll(); Map<String, List<Seat>> seatMapGroups = all.stream().collect(Collectors.groupingBy(Seat::getSeatGroup)); return new SeatmapResponse(seatMapGroups); }
Source:
<code>public Path getFileName() { int index = pathString.lastIndexOf(SEPARATOR); if (index == -1) { return new Path(pathString); } else { if(index == pathString.length() - 1) { <START> return null; <END> } else { return new Path(pathString.substring(index + 1)); } } }</code><technical_language>nan</technical_language>

Target:
public Path getFileName() { int index = pathString.lastIndexOf(SEPARATOR); if (index == -1) { return new Path(pathString); } else { if(index == pathString.length() - 1) { if (index == 0) { return null; } else { int secondLastIndex = pathString.lastIndexOf(SEPARATOR, index - 1); return new Path(pathString.substring(secondLastIndex + 1, index)); } } else { return new Path(pathString.substring(index + 1)); } } }
Source:
<code>public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) <START> throws AllocationConfigurationException { <END> return true; }</code><technical_language>sense for this method boolean. I throwing exception here. caller decide based return value</technical_language>

Target:
public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) { return true; }
Source:
<code>protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) <START> .append("imageTicket", <END> ticket.getOps()) .append("size", ticket.getSize()) .append("url", ticket.getUrl()) .append("filename", ticket.getFilename()) .append("sparse", ticket.isSparse()) .append("transferId", Guid.createGuidFromString(ticket.getTransferId())) .append("dirty", ticket.isDirty()); }</code><technical_language>intentionally changed "operations"</technical_language>

Target:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("operations", ticket.getOps()) .append("size", ticket.getSize()) .append("url", ticket.getUrl()) .append("filename", ticket.getFilename()) .append("sparse", ticket.isSparse()) .append("transferId", ticket.getTransferId()) .append("dirty", ticket.isDirty()); }
Source:
<code>protected void afterTestsStopped() throws Exception { <START> BPlusTree.pageHndWrapper = regularPageHndWrapper == null ? ((tree, hnd) -> hnd) : regularPageHndWrapper; <END> }</code><technical_language>Seems, regularPageHndWrapper is null here. If BPlusTree.pageHndWrapper null in beforeTestsStarted, null restored</technical_language>

Target:
protected void afterTestsStopped() throws Exception { }
Source:
<code>protected void limitTotalNumberOfCnxns() throws IOException { if (maxCnxns <= 0) { return; } int cnxns = getNumAliveConnections(); if (cnxns >= maxCnxns) { <START> throw new IOException("Too many connections " + cnxns + " - max is " + maxCnxns); <END> } }</code><technical_language>A graceful shutdown nice. of ServerMetrics.getMetrics().CONNECTION_REJECTED in code base. Alternately, reuse ClientCnxnLimitException exception</technical_language>

Target:
protected boolean limitTotalNumberOfCnxns() { if (maxCnxns <= 0) { return false; } int cnxns = getNumAliveConnections(); if (cnxns >= maxCnxns) { LOG.error("Too many connections " + cnxns + " - max is " + maxCnxns); return true; } return false; }
Source:
<code>void flush() { Producer<K, V> producer; try { _producerLock.lock(); producer = _kafkaProducer; } finally { _producerLock.unlock(); } try { if (producer != null) { producer.flush(_producerFlushTimeoutMs, TimeUnit.MILLISECONDS); } } catch (InterruptException | TimeoutException e) { <START> if (producer == _kafkaProducer) { <END> _log.warn("Kafka producer flush interrupted/timed out, closing producer {}.", producer); shutdownProducer(); } else { _log.warn("Kafka producer flush interrupted/timed out, producer already closed.", producer); } throw e; } }</code><technical_language>checking _kafkaProducer lock. _kafkaProducer change time shutdownProducer() is called. instead a shutdownProducer(producer) this comparison lock calls shutdownProducer(), lines</technical_language>

Target:
void flush() { Producer<K, V> producer; try { _producerLock.lock(); producer = _kafkaProducer; } finally { _producerLock.unlock(); } if (producer != null) { try { producer.flush(_producerFlushTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptException | TimeoutException e) { try { _producerLock.lock(); if (producer == _kafkaProducer) { _log.warn("Kafka producer flush interrupted/timed out, closing producer {}.", producer); shutdownProducer(); } else { _log.warn("Kafka producer flush interrupted/timed out, producer already closed.", producer); } throw e; } finally { _producerLock.unlock(); } } } }
Source:
<code>private void loadExchangeInfo() throws ExchangeManagerException { exInfo = getExchangeInfoDAO().loadExchangeInfo(); if (exInfo != null) { synchronized (exCache) { exCache.clear(); if (null != exInfo.getExchanges() && CollectionUtils.isNotEmpty(exInfo.getExchanges().getExchange())) { for (ExchangeType ex : exInfo.getExchanges().getExchange()) { if (isOverrideExchange(ex)) { <START> overrideExchange = ex; <END> } else { updateExchangeCache(ex); } } exCacheLoaded = true; exFileLastUpdateTime = getExchangeInfoDAO().getLastModified(); } } } else { LOG.error("No Exchange Information found"); } }</code><technical_language>Do need break here? is requirement / possibility of multiple overrides defined? stands if more one, latest stick previous overwritten</technical_language>

Target:
private void loadExchangeInfo() throws ExchangeManagerException { exInfo = getExchangeInfoDAO().loadExchangeInfo(); overrideExchange = null; if (exInfo != null) { synchronized (exCache) { exCache.clear(); if (null != exInfo.getExchanges() && CollectionUtils.isNotEmpty(exInfo.getExchanges().getExchange())) { for (ExchangeType ex : exInfo.getExchanges().getExchange()) { if (isOverrideExchange(ex)) { if (null != overrideExchange) { LOG.warn( "Found more than one overrides exchange type .. overwriting the previous exchange"); } overrideExchange = ex; } else { updateExchangeCache(ex); } } exCacheLoaded = true; exFileLastUpdateTime = getExchangeInfoDAO().getLastModified(); } } } else { LOG.error("No Exchange Information found"); } }
Source:
<code>RecordedEventSerializer(EntityManager entityManager) { ReflectionReflectFactory reflectFactory = new ReflectionReflectFactory(); CopyStrategyLibrary copyStrategyLibrary = new CopyStrategyLibrary(reflectFactory); this.typeSerializationLibrary = TypeSerializationLibrary.createDefaultLibrary(reflectFactory, copyStrategyLibrary); typeSerializationLibrary.add(EntityRef.class, new EntityRefTypeHandler((EngineEntityManager) entityManager)); typeSerializationLibrary.add(MouseAxisEvent.MouseAxis.class, new EnumTypeHandler<>(MouseAxisEvent.MouseAxis.class)); typeSerializationLibrary.add(ButtonState.class, new EnumTypeHandler<>(ButtonState.class)); typeSerializationLibrary.add(Keyboard.Key.class, new EnumTypeHandler<>(Keyboard.Key.class)); <START> typeSerializationLibrary.add(MouseInput.class, new EnumTypeHandler<>(MouseInput.class)); <END> this.entityManager = entityManager; }</code><technical_language>AFAIK, do need explicitly add a type handler for enum if default EnumTypeHandler</technical_language>

Target:
RecordedEventSerializer(EntityManager entityManager) { ReflectionReflectFactory reflectFactory = new ReflectionReflectFactory(); CopyStrategyLibrary copyStrategyLibrary = new CopyStrategyLibrary(reflectFactory); this.typeSerializationLibrary = TypeSerializationLibrary.createDefaultLibrary(reflectFactory, copyStrategyLibrary); typeSerializationLibrary.add(EntityRef.class, new EntityRefTypeHandler((EngineEntityManager) entityManager)); typeSerializationLibrary.add(MouseAxisEvent.MouseAxis.class, new EnumTypeHandler<>(MouseAxisEvent.MouseAxis.class)); typeSerializationLibrary.add(ButtonState.class, new EnumTypeHandler<>(ButtonState.class)); typeSerializationLibrary.add(Keyboard.Key.class, new EnumTypeHandler<>(Keyboard.Key.class)); typeSerializationLibrary.add(MouseInput.class, new EnumTypeHandler<>(MouseInput.class)); typeSerializationLibrary.add(MovementMode.class, new EnumTypeHandler<>(MovementMode.class)); this.entityManager = entityManager; }